终端显示启动时 PATH 变量的'no such file or directory'



当我启动终端时,我收到以下消息:

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/ruby-2.0.0-head@global/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

我意识到有多个PebbleSDK,第一个的路径肯定是错误的。 找不到从哪里提取。

另外,当我在终端中键入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/ruby-2.0.0-head@global/bin:/Users/ryan/.rvm/rubies/ruby-2.0.0-head/bin:/Users/ryan/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

这也是不对的,因为它有更多的PebbleSDK

我有三个问题: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;%sa' "$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文件将位于何处?

检查~/.bashrc.bash_profile是否有将赋值PATH=...作为参数传递给cd的代码。

相关内容

  • 没有找到相关文章

最新更新