最近头儿给创建了一个用户,我打算在自己的家目录下.bash_profile需要修改PATH,结果重新登录,发现路径并没有添加成功。即登陆shell并没有执行.bash_profile.
问题解决: echo $SHELL 首先查看自己使用的shell版本。自己一看才知道是/bin/sh。这样当然在.bash_profile中修改不成功了
╮(╯▽╰)╭。。。
解决办法:修改用户shell usermod -s /bin/bash xxxx
扩展知识:
注:以bash为例。登陆shell 执行/etc/profile ~/.bash_profile 非登陆shell 只执行~/.bashrc。
bash:
/etc/profile
~/.bash_profile 是交互式、登陆shell执行
~/.bashrc 是交互式、非login shell执行
ksh:
/etc/profile
~/.profile
~/.kshrc
csh:
/etc/.login
~/.login
~/.cshrc
本文介绍了解决.bash_profile未被加载的问题,通过更改用户默认Shell为bash,确保配置文件正确执行。文章还解释了不同Shell类型下配置文件的区别。
495

被折叠的 条评论
为什么被折叠?



