什么情况?
我在 ~/.profile 末尾加入 npm 激活脚本.
if [ -f "$HOME/.nvm/nvm.sh" ]; then
. "$HOME/.nvm/nvm.sh"
fi
结果发现 Terminal 好像并没有要读取 ~/.profile 的样子.
Terminal 不加载 ~/.profile
- colder
- 帖子: 4
- 注册时间: 2008-11-08 10:40
- eexpress
- 帖子: 58428
- 注册时间: 2005-08-14 21:55
- 来自: 长沙
- lilydjwg
- 论坛版主
- 帖子: 4258
- 注册时间: 2009-04-11 23:46
- 系统: Arch Linux
- 联系:
Re: Terminal 不加载 ~/.profile
login shell 才加载那个。
- colder
- 帖子: 4
- 注册时间: 2008-11-08 10:40
Re: Terminal 不加载 ~/.profile
那我该放在哪里才好呢?eexpress 写了:某些配置会废弃的。换个地方嘛。
之前有玩OSX, 现在刚到Ubuntu下, 有点迷糊.
这个Terminal是什么? 不是bash吗?
- leeaman
- 帖子: 30702
- 注册时间: 2007-02-02 18:14
- 系统: debian sid
- colder
- 帖子: 4
- 注册时间: 2008-11-08 10:40
Re: Terminal 不加载 ~/.profile
谢谢, 果然是这样, 可是还是有点迷糊.leeaman 写了:放.bashrc没错吧?
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
问题是我的用户目录下没有 .bash_profile 和 .bash_login.
只有 .bash_history 和 .bash_logout
- naturalaw
- 帖子: 1360
- 注册时间: 2011-09-06 22:04
Re: Terminal 不加载 ~/.profile
你可以創建啊.
如果有,就不讀取了~/.profileif ~/.bash_profile or ~/.bash_login
- 永恒之法则
- The eternal law
- colder
- 帖子: 4
- 注册时间: 2008-11-08 10:40
Re: Terminal 不加载 ~/.profile
看来每种发行版, bash 配置文件的加载也是不同的.
对于Ubuntu 11.10来说, 加载顺序应该是:
/etc/profile
/etc/profile.d/*.sh
/etc/bash.bashrc
~/etc/.profile (登录时加载一次)
~/etc/.bashrc (每次打开Terminal时加载)
但是系统的预安装配置里把~/.bash_profile给丢掉了.
在OSX里又是另外一回事, 每次打开Terminal都加载~/.profile, 其他的都被忽略了.
对于Ubuntu 11.10来说, 加载顺序应该是:
/etc/profile
/etc/profile.d/*.sh
/etc/bash.bashrc
~/etc/.profile (登录时加载一次)
~/etc/.bashrc (每次打开Terminal时加载)
但是系统的预安装配置里把~/.bash_profile给丢掉了.
在OSX里又是另外一回事, 每次打开Terminal都加载~/.profile, 其他的都被忽略了.