繁体   English   中英

Bash .profile未加载

[英]Bash .profile not loading

我不确定发生了什么,但是我的〜/ .profile不再加载。

有人可以看到以下内容有问题吗?

export PS1="\u@local [\w]# "
export EDITOR="subl -w"
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced

alias vst="ssh -i ~/.ssh/vst root@vst"

我知道使用PS1这样的事实,就像我尝试做的那样,应该是Peter@local [~/path/to/file]#但事实并非如此。

有任何想法吗?

~/.bash_profile~/.bash_login存在? 如果是这样,将使用它代替~/.profile

Unix FAQ(对于OS X)中,我们可以阅读:

Bash启动文件

当“登录外壳”启动时,它将读取文件/etc/profile ,然后读取~/.bash_profile~/.bash_login~/.profile无论存在哪一个,它仅读取其中之一 ,并在提到的订单)。

当“非登录外壳”启动时,它将读取文件/etc/bashrc ,然后读取文件~/.bashrc

请注意,当使用名称sh调用bash时,它将尝试模仿Bourne shell( sh )的启动顺序。 特别是, 默认情况下,以sh调用的非登录shell不会读取任何点文件 有关详细信息,请参见bash手册页。

因此,如果您已经拥有~/.bash_profile ,则bash不会自动读取文件~/.profile ,因此您可以在~/.bash_profile添加以下行以进行加载:

# Load user profile file
if [ -f ~/.profile ]; then
  . ~/.profile
fi

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM