On Tue, Mar 18, 2003 at 05:03:22PM -0500, Mark D Pace wrote:
> When I want to change environment variables for a user I put them in
> .bashrc in there home directory.
.bashrc is re-sourced on each shell. Adding definitions there is one
good way to mess your life.
You find yourself with a PATH that has:
usr/local/bin:/bin:/usr/games:/usr/X11R6/bin:/system/bin:/home/me/bin:/home/me/bin:/home/me/bin:/home/me/bin
(Because you were smart and used PATH="${PATH}:${HOME}/bin) to avoid
overriding the system path)
Use .profile , or .bash_profile . If it is not executed, use something
like:
in .bashrc :
if [ -z "$PROFILE_EXECUTED" ];
then
. .profile # careful not to source there .bashrc!
fi
and the first thing in .profile:
PROFILE_EXECUTED=1
export PROFILE_EXECUTED
BTW: there is also /etc/profile and (on redhat and suse) /etc/profile.d
>
> I wanted to change root's environment variables but I did not find a
> .bashrc in /root. So I created a .bashrc and put in my export commands.
> But when I logon to root it doesn't appear that .bashrc is being executed.
> Where do I change root's environment variables?
Do you by any chance use 'su' (without '-')?
--
Tzafrir Cohen
mailto:[EMAIL PROTECTED]
http://www.technion.ac.il/~tzafrir/