Re: /etc/profile or $HOME/profile
- From: "Richard B. Gilbert" <rgilbert88@xxxxxxxxxxx>
- Date: Wed, 17 May 2006 21:27:31 -0400
googler wrote:
News wrote:
ehabaziz2001@xxxxxxxxx wrote:
Is /etc/profile executed when any user login to the system ?
Only those users with sh, ksh or bash as their login shell. Then
$HOME/.profile gets processed (it gets more complex but that is the general
order.)
I have a similar question. I created an user account and then changed
its shell to bash (from sh). Everything is fine. Now I wanted to add
more directories to my PATH variable. So in ~/.profile, I added the
lines:
PATH=/opt/SUNWspro/bin:${PATH}
export PATH
After this I changed the permission of .profile to enable x mode and
ran (from $HOME) ./.profile . This _did not_ change the PATH variable
as was evident from "echo $PATH". So I put "echo $PATH" in .profile
just after setting PATH, and it displays the correct value. At this
point, I logged off and logged back in and saw that PATH has been set
correctly. Why isn't it changing on running ./.profile in the earlier
case?
Because ./.profile spawned a subprocess to execute .profile. The PATH environment was set in the suprocess and lost when the subprocess terminated. You CAN NOT alter the environment of a another process.
Try "source .profile" if the shell you are using supports it.
.
- References:
- /etc/profile or $HOME/profile
- From: ehabaziz2001
- Re: /etc/profile or $HOME/profile
- From: Crazy Eyes
- Re: /etc/profile or $HOME/profile
- From: ehabaziz2001
- Re: /etc/profile or $HOME/profile
- From: News
- Re: /etc/profile or $HOME/profile
- From: googler
- /etc/profile or $HOME/profile
- Prev by Date: Re: Leaving a process running after log-off
- Next by Date: Re: Leaving a process running after log-off
- Previous by thread: Re: /etc/profile or $HOME/profile
- Next by thread: Re: /etc/profile or $HOME/profile
- Index(es):
Relevant Pages
|