2017-07-11 21 views
0

太多(的警告是在PATH部分 問題當我嘗試修復PATHsetenv然後我得到:C-shell語法:在.cshrc中

set: Variable name must begin with a letter. 

這裏是一個剪斷的文件:

setenv MAIL /usr/spool/mail/$USER 
setenv MATLABPATH /home/users/me/matlab/functions:/home/users/me/matlab/scripts 
setenv PYTHONPATH /home/users/me/python/modules:/home/users/me/python/scripts 
set path=(/sbin /bin /usr/bin /usr/local/bin /usr/local/java/bin 
      /usr/bin/X11 ~/bin) 
if (! $?csh) then 
    if($?prompt) then 
     set prmptchr=$prompt 
    else 
     set prmptchr="/" 
    endif 
    alias setprompt 'set prompt = "$cwd$prmptchr "' # directory name in prompt 
    alias cd 'chdir \!*; setprompt' 
    alias pushd 'pushd \!*; setprompt' 
    alias popd 'popd \!*; setprompt' 
    setprompt 
endif 
+0

是,proble m位於「路徑」部分。它應該全部位於同一行上,或者您需要在任何未終止行的末尾使用連續字符。即'..../usr/local/java/bin \\'。不是一個真正的編程Q,將來請在http://superuser.com上發佈這樣的查詢。並請閱讀http://stackoverflow.com/help/how-to-ask,http://stackoverflow.com/help/dont-ask,http://stackoverflow.com/help/mcve並參加[tour] (http://stackoverflow.com/tour),然後再發布更多Q​​值。祝你好運。 – shellter

+0

@shelter抱歉,我會牢記它。現在我得到這個: 設置:變量名稱必須以字母開頭。 if(!$?csh)if if(if /!bin/bin/usr/bin/usr/local/bin/usr/local/java/bin /usr/bin/X11〜/ bin)if ($?提示),那麼 集prmptchr = $提示符 其他 集prmptchr = 「/」 ENDIF 別名setprompt '設置提示= 「$ CWD $ prmptchr」' 在 提示 別名CD「CHDIR \#目錄名! *; setprompt' 別名pushd'pushd \!*; setprompt' alias popd'popd \!*; setprompt' setprompt' – RobbieTheK

+0

您所做的唯一改變是否在一行上?當我將你的代碼複製/粘貼到我的'csh'中時,它都可以工作。對不起,今天很忙,有空的時候會回來看看。祝你好運。 – shellter

回答

1

這裏是修正後的2個問題:

setenv MAIL /usr/spool/mail/$USER 
setenv MATLABPATH /home/users/me/matlab/functions:/home/users/me/matlab/scripts 
setenv PYTHONPATH /home/users/me/python/modules:/home/users/me/python/scripts 

# Added \ to split across multiple lines 
set path=(/sbin /bin /usr/bin /usr/local/bin /usr/local/java/bin \ 
      /usr/bin/X11 ~/bin) 
if (! $?csh) then 
    if($?prompt) then 
     # Added " around $prompt to make sure it's quoted correctly. 
     set prmptchr="$prompt" 
    else 
     set prmptchr="/" 
    endif 
    alias setprompt 'set prompt = "$cwd$prmptchr "' # directory name in prompt 
    alias cd 'chdir \!*; setprompt' 
    alias pushd 'pushd \!*; setprompt' 
    alias popd 'popd \!*; setprompt' 
    setprompt 
endif 
+0

除了「路徑」的延續字符之外還有什麼變化?我看不到它,正如我所提到的,當我粘貼你的原始代碼('path ='全部在一行上)時,它就起作用了。很高興你找到了解決方案。如果你不知道,你可以接受你自己的解決方案作爲答案,並獲得寶貴的聲譽點。祝你好運,並繼續發佈。 – shellter

+1

@shellter'set prmptchr =「$ prompt」中的引號' – Carpetsmoker