~/.bash_profile在某些情况下没有执行

部署运行你感兴趣的模型镜像
下面是解释
Opening a new terminal in X invokes bash as an interactive shell, but not as a login shell. Therefore your ~/.bash_profile will not execute, but your ~/.bashrc should.
.bash_profile is only supposed to be run once, by the login shell. .bashrc is the file that's run for each child.
意思是,只有是interactive login shell(交互式登录终端)的情况下,才会执行~/.bash_profile,~/.bash_profile会调用~/.bashrc,看~/.bash_profile内容即知。
如果不是interactive login shell,例如启动X终端,或者ssh自动登录,这相当于启动了一个登录终端的child,只会执行~/.bashrc。


实验验证:
我是用putty登录的,用了ssh,启动时执行了screen。
在~/.bash_profile末尾加上
    echo bash_profile ran $(date)
在~/.bashrc末尾加上
    echo bashrc ran $(date)
重新用putty登录,得到
    .bashrc ran Wed Feb 27 09:34:40 CST 2013
看来,我登录的情况,只有~/.bashrc得到了执行。
更详细的解释,man bash 看INVOCATION 段。

您可能感兴趣的与本文相关的镜像

Stable-Diffusion-3.5

Stable-Diffusion-3.5

图片生成
Stable-Diffusion

Stable Diffusion 3.5 (SD 3.5) 是由 Stability AI 推出的新一代文本到图像生成模型,相比 3.0 版本,它提升了图像质量、运行速度和硬件效率

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值