2014-01-06 45 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

相关问题