Re: /etc/profile or $HOME/profile



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.
.



Relevant Pages

  • Re: User profiles
    ... When you are in a workgroup environment (well, I am assuming that this is ... moment) and the users log on with local user accounts that profile is ... When userA logs on using the domain user account object ( ...
    (microsoft.public.win2000.active_directory)
  • Re: Where is su profile??
    ... My problem is, where is the profile ... I moved all of our admin scripts ... The environment includes the HOME environment ... 'su -' produces a shell that is considered a "login ...
    (comp.sys.hp.hpux)
  • Re: Acrobat 7.0 for linux is out
    ... only for that shell and all child processes. ... What I do is have my .profile set up the environment. ... In my .bashrc I set up bash specific, ...
    (Debian-User)
  • Login Shell/Profile: Stop the Madness
    ... After much consternation I feel the need to vent about shell environment ... trigger profile initialization. ... Source the profile from ~/.bashrc. ...
    (Debian-User)
  • Re: some queris on .profile file
    ... then some-script.sh is sourced into current running shell, ... Single dot is equivalent to source'ing some script, ... If I have execute .profile then the command would be ... local variables, environment variables, shell options, aliases, ...
    (comp.unix.tru64)