Re: Where is a good reference for setting PATH in all the various shells
Denis Hennessy <[email protected]>
| Newsgroups | gmane.linux.redhat.taroon |
|---|---|
| Message-ID | <[email protected]> |
If you look at the /etc/profile file (on redhat system), you'll see code like this: > for i in /etc/profile.d/*.sh ; do > if [ -r "$i" ]; then > . $i > fi > done This is what executes each script in the profile.d directory with a .sh extension. /dh Aaron Neerenberg wrote: >Let me suggest that you read the man page entries for the various shells >you are interested in working with. For example, the man page for bash >states: > > When bash is invoked as an interactive login shell, or as a >non-interactive shell with the --login option, it first reads and >executes commands from the file /etc/profile, if that file exists. >After reading that file, it looks for ~/.bash_profile, ~/.bash_login, >and ~/.profile, in that order, and reads and executes commands from the >first one that exists and is readable. The --noprofile option may be >used when the shell is started to inhibit this behavior. > >-Aaron > > >On Thu, 2003-09-11 at 09:13, Douglas Phillipson wrote: > > >>OK, I was trying not to show my ignorance on this matter but I guess >>I'll have to by asking some direct questions. I don't understand the >>/etc/profile.d mechanism. When do these scripts get run? Automaticly >>during boot, or when some app intentionally runs them, at some run >>level, when? If I put a script that sets and EXPORTS PATH there does it >>get run automaticly and will bash use that path? >> >>Regards >> >>DSP >> >>John wrote: >> >> >>>On Thursday 11 September 2003 15:24, Göran Uddeborg wrote: >>> >>> >>> >>>>Ed Wilts writes: >>>> >>>> >>>> >>>>>The biggest reason is that every shell would have to be modified to >>>>>consult this file. >>>>> >>>>> >>>>Not really. You could have code in the startup scripts which used >>>>this file. If for example, /etc/defaultpath contains just a >>>>colon-separated path, you could add >>>> >>>> PATH=`cat /etc/defaultpath` >>>> >>>> >>>You would need to take care with that, because other scripts in /etc/profile.d >>>may change PATH. >>> >>>You need to split /etc/defaultpath, and only add to PATH those bits that are >>>necessary. >>> >>>RH, but not user sites, could modify /etc/proiile & /etc/csh.cshrc to do that >>>before looking in /etc/profile.d >>> >>> >>> >>> >>> >>-- >>Taroon-beta-list mailing list >>[email protected] >>http://www.redhat.com/mailman/listinfo/taroon-beta-list >> >> -- Taroon-beta-list mailing list [email protected] http://www.redhat.com/mailman/listinfo/taroon-beta-list