Re: PATH variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 08, 2004 at 08:02:27AM +0200, Joachim Backes wrote:

> can somebody tell me where the PATH variable is initially set? I'm
> sure, not in /etc/profile.

The strict answer to this is that it is set 
by init (/sbin/init).

   PATH=/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin

Since init is the first process from which all other processes are
created this is the answer to your question.   

Once init is running the topic  expands through /etc/inittab processing 
which includes all the scripts in /etc/init.d.

One of these steps is especially interesting for users at run level 5.

   # Run xdm in runlevel 5
   x:5:respawn:/etc/X11/prefdm -nodaemon

The first line with code in it resets the path thus:

   PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin

Now that a display manager is running it might be reset again.
For gdm we see this line in /usr/bin/gdm.

  test -f /etc/profile && . /etc/profile

/etc/profile does its pathmunge thing....
and then all these are /etc/profile.d/*.sh so if 
kerberos is there krb5.sh will modify it again.

All of this might be interesting because a process launched with a
quick click from the desktop by the window manager might act
differently when compared to the same process launched from a shell
prompt.

Not to be left out is your shell as defined in /etc/passwd
(bash, csh, tcsh, ksh, sh, zsh).  Each shell has rules for
startup and standard files it looks at... often PATH is reset
there.   The csh and tcsh world is funny because $path  is
almost equal to $PATH (RTFM).


-- 
	T o m  M i t c h e l l 
	Just say no to 74LS73 in 2004



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux