[RndTbl] PATH problem

Gilles Detillieux grdetil at scrc.umanitoba.ca
Thu Jan 3 15:55:18 CST 2002


According to Gilbert E. Detillieux:
> According to author:
> > How do I make an entry to the Red Hat 7.1
> > system wide PATH ?
> > I've looked up /etc/profile and it doesn't look
> > like something that should be edited. Besides,
> > I can't see a typical PATH line to edit.
> > So I took a look at /root/.bash_profile and
> > it looks more like what I'm used to. But that's
> > only good for loggin in root and I don't always
> > do that.
> > I'm used to Slackware where all you have to
> > do is edit the /etc/profile file to add a program
> > to the system wide PATH.
> > What do I have to do in Red Hat 7.1 to add
> > something like /usr/local/Slab/effects  to the
> > PATH ?  And what file records the PATH?
> >   Any hints would be appreciated. 
> 
> Under Red Hat systems, /etc/profile is indeed the place to change it.
> 
> You'll note constructs such as this at the start of the file...
> 
> if ! echo $PATH | /bin/grep -q "/usr/X11R6/bin" ; then
>     PATH="$PATH:/usr/X11R6/bin"
> fi
> 
> These are done to add the path component only if it's not already there, to
> avoid duplication, and to avoid simply clobbering the existing components in
> the path.  Just mimic that construct for any additional directories you want
> to add.
> 
> Note that this file (/etc/profile) will be used by any user (including root)
> that has a Bourne shell (including bash) as their login shell.  You might
> also want to do something similar for csh (and tcsh) users, by adding
> something equivalent (with appropriate syntax for that shell) to the
> /etc/csh.cshrc and/or /etc/csh.login files, if you have any users of those
> shells.

You can also add files to /etc/profile.d to do any package-specific
setup of the path or other environment variables.  *.sh files in there
will be run by any sh, bash, ksh or zsh user, while *.csh files will be
run by any csh or tcsh user.  The beauty of this is that files can be
added and removed by RPM packages without having to modify the standard
/etc/profile or /etc/csh.login files.

-- 
Gilles R. Detillieux              E-mail: <grdetil at scrc.umanitoba.ca>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/~grdetil
Dept. Physiology, U. of Manitoba  Phone:  (204)789-3766
Winnipeg, MB  R3E 3J7  (Canada)   Fax:    (204)789-3930



More information about the Roundtable mailing list