开发者

After changing /etc/profile, what do I have to do to reset my shell?

开发者 https://www.devze.com 2023-02-04 09:11 出处:网络
To test its effects immediately instead of having to开发者_如何学C reload the terminaluse source /etc/profile

To test its effects immediately instead of having to开发者_如何学C reload the terminal


use source /etc/profile

for details, man source or you can checkout this link http://bash.cyberciti.biz/guide/Source_command


If this is bash you can do . /etc/profile, it's the same as doing source /etc/profile.


As sjr says, you can approximate the effect of the change by re-reading /etc/profile using the dot . (or, in Bash, source) command.

However, you need to be aware that /etc/profile gets to work with a more minimal starting environment, so the effect you get by rereading the profile is not necessarily identical to the effect you get on login. You can simulate the original environment more accurately using the env command to unset the environment. With bash, you can use the -l option to make the shell behave more like a login shell - in conjunction with env, you can simulate the login environment accurately:

env -i HOME=$HOME PATH=/bin:/usr/bin USER=$USER ... bash -l
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号