On Wednesday 08 August 2007, Will Maier wrote:
> > 4. change /etc/ksh.kshrc and create .kshrc sourcing /etc/ksh.kshrc
> > for all users (and in /etc/skel...)
>
> And this.

ummm. I don't think so.

The .profile is read only *once* on initial login. Everything that is 
spawned from your initial login will inherit the given environment.

In contrast, your shell rc files (.kshrc, .chsrc, etc) will be read on 
each new instance of the shell (which you spawn from your original 
login).

So, if in .kshrc you do something like this:

  PATH=$PATH:/usr/local/jdk-1.5.0/bin
  export PATH

your path will grow on each new instance of the shell

$ echo $PATH
/home/jcr/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games:.:/usr/local/java/bin:/home/jcr/ida/
$ echo 'PATH=$PATH:/usr/local/jdk-1.5.0/bin' >> .kshrc
$ echo 'export  PATH' >> .kshrc                        
$ ksh
$ ksh
$ ksh
$ echo $PATH
/home/jcr/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games:.:/usr/local/java/bin:/home/jcr/ida/:/usr/local/jdk-1.5.0/bin:/usr/local/jdk-1.5.0/bin:/usr/local/jdk-1.5.0/bin
$ 

Is this a really problem? -probably not but then again, it is not what 
one would expect and violates the element of least surprise.

kind regards,
jcr

Reply via email to