bash 终端在启动时显示 PATH 变量“没有这样的文件或目录”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20953313/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Terminal showing 'no such file or directory' for PATH variable on startup
提问by ryanpitts1
When i start my Terminal i get this message:
当我启动我的终端时,我收到此消息:
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
I realize there are multiple PebbleSDKs and the first one's path is definitely wrong. Cannot find where this is getting pulled from.
我意识到有多个 PebbleSDK,第一个路径肯定是错误的。找不到这是从哪里拉出来的。
Also, when i type echo $PATH
into terminal i get:
另外,当我输入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
Which is also not right since it has even more multiplePebbleSDKs in it.
这也是不对的,因为它有更加多的它PebbleSDKs。
I have three questions:
1) Where is the inital PATH getting pulled from?
2) Where is the echo $PATH
pulling from?
3 Why are they different?
我有三个问题:1)初始 PATH 是从哪里拉出来的?2)从哪里echo $PATH
拉?3 为什么不一样?
Thanks!
谢谢!
UPDATE 1:
更新 1:
This is what i have in /etc/bashrc
:
这就是我所拥有的/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
This is what i have in /etc/profile
:
这就是我所拥有的/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
Where would the .bashrc
, .bash_profile
, and .profile
files you mentioned be located?
将在什么地方.bashrc
,.bash_profile
和.profile
你提到的文件放置在何处?
采纳答案by chepner
Check ~/.bashrc
or .bash_profile
for code that passes the assignment PATH=...
as an argument to cd
.
检查~/.bashrc
或.bash_profile
将赋值PATH=...
作为参数传递给 的代码cd
。