2014-01-06 43 views
2

PATH變量「沒有這樣的文件或目錄」:終端顯示當我開始我的終端,我得到這個消息在啓動時

bash: cd: PATH=/Users/ryan/Users/ryan/Documents/Pebble-Dev/PebbleSDK-2.0-BETA3/bin:/Users/ryan/pebble-dev/PebbleSDK-2.0-BETA4/bin:/Users/ryan/.rvm/gems/ruby-2.0.0-head/bin:/Users/ryan/.rvm/gems/[email protected]/bin:/Users/ryan/.rvm/rubies/ruby-2.0.0-head/bin:/Users/ryan/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin: No such file or directory 

我知道有多重PebbleSDKs,第一個的路徑肯定是不對的。找不到從哪裏撤出。

而且,當我鍵入echo $PATH到終端,我得到:

/Users/ryan/pebble-dev/PebbleSDK-2.0-BETA4/bin:/Users/ryan/pebble-dev/PebbleSDK-2.0-BETA4/bin:/Users/ryan/pebble-dev/PebbleSDK-2.0-BETA4/bin:/Users/ryan/Documents/Pebble-Dev/PebbleSDK-2.0-BETA3/bin:/Users/ryan/pebble-dev/PebbleSDK-2.0-BETA4/bin:/Users/ryan/.rvm/gems/ruby-2.0.0-head/bin:/Users/ryan/.rvm/gems/[email protected]/bin:/Users/ryan/.rvm/rubies/ruby-2.0.0-head/bin:/Users/ryan/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin 

這也是不對的,因爲它有更多個 PebbleSDKs在裏面。

我有三個問題: 1)初始PATH從哪裏被拉出? 2)echo $PATH從哪裏拉? 3他們爲什麼不同?

謝謝!

更新1:

這是我在/etc/bashrc

# System-wide .bashrc file for interactive bash(1) shells. 
if [ -z "$PS1" ]; then 
    return 
fi 

PS1='\h:\W \u\$ ' 
# Make bash check its window size after a process completes 
shopt -s checkwinsize 
# Tell the terminal about the working directory at each prompt. 
if [ "$TERM_PROGRAM" == "Apple_Terminal" ] && [ -z "$INSIDE_EMACS" ]; then 
    update_terminal_cwd() { 
     # Identify the directory using a "file:" scheme URL, 
     # including the host name to disambiguate local vs. 
     # remote connections. Percent-escape spaces. 
    local SEARCH=' ' 
    local REPLACE='%20' 
    local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}" 
    printf '\e]7;%s\a' "$PWD_URL" 
    } 
    PROMPT_COMMAND="update_terminal_cwd; $PROMPT_COMMAND" 
fi 

這是我在/etc/profile

# System-wide .profile for sh(1) 

if [ -x /usr/libexec/path_helper ]; then 
eval `/usr/libexec/path_helper -s` 
fi 

if [ "${BASH-no}" != "no" ]; then 
[ -r /etc/bashrc ] && . /etc/bashrc 
fi 

將在什麼地方.bashrc.bash_profile,和.profile您提到的文件位於?

+0

真正的問題是,在你的配置文件中,你是否試圖將作業傳遞給'PATH'作爲'cd'的參數? – chepner

+0

我不知道...不是我的機器發生這種情況。我可以從哪裏開始尋找? – ryanpitts1

+2

'.bashrc','.bash_profile'和'.profile'是很好的開始。系統文件不太可能,但可能是'/ etc/profile'和'/ etc/bashrc'。 – chepner

回答

2

檢查~/.bashrc.bash_profile代碼將代碼PATH=...作爲參數傳遞給cd

+0

請您詳細介紹一下嗎?我對Unix終端很陌生,明白你的意思是「通過賦值PATH = ...的代碼作爲cd的參數。」 –

+0

如果一個啓動文件包含一個類似'cd PATH = ...'的行,shell會將其解釋爲將工作目錄更改爲名爲'PATH = ...'的請求。 – chepner

相關問題