-   Slackware (
-   -   Saving system environment variables (

garyg007 12-01-2008 09:00 PM

Saving system environment variables
This is having me sitting under my desk and talking to myself.

I have been trying to add a couple of directories to the PATH
system environment variable; works fine and does what I want it to do
UNTIL I RE-BOOT --- then everything I added is no longer there.
I tried


export PATH=$PATH:/stuff/I/added

export PATH=all/the/old/stuff:stuff/I/added
nothing keeps the changes across system re-starts.

How do I make this happen?


T3slider 12-01-2008 09:06 PM

You should add one of those lines (probably the first one) to ~/.bashrc (or .bash_profile...). See `man bash` (see the INVOCATION section about .bashrc and .bash_profile for information on which one to use). Create the file if it doesn't exist.

Woodsman 12-01-2008 09:57 PM

The bulk of the stock Slackware PATH assignments are located in /etc/profile.d scripts. Those scripts are executed from within the /etc/profile script.

If your path assignments are system-wide and not specific to your normal user account, then create a new script in /etc/profile.d:

touch /etc/profile.d/
chmod +x /etc/profile.d/
mcedit /etc/profile.d/

Then add your new PATH variable as you desire:

export PATH

Save the document.

If the PATH asssignments are specific only to y our normal user account, then place the commands in $HOME/.bashrc.

If you want more information about bash startup scripts:

Harmonizing the Bash Startup Scripts

garyg007 12-01-2008 11:12 PM

Woodsman, Thanks for the nice reply - only problem - with the link you provided - it's going to take my retired senile brain a few days to absorb enough to lift me out of the dangerous zone


acummings 12-02-2008 02:00 AM


al@G33T-M2:~$ cat .bashrc

[ -f /home/al/.term_aliases ] && . /home/al/.term_aliases
[ -f /etc/profile ] && . /etc/profile
export PATH=$PATH:/home/al/bin

FWIW (if this helps any) that export line in my .bashrc adds that folder onto my path (for me, user al)


garyg007 12-03-2008 07:06 PM

I added this text file to /etc/profile.d;

# this is located in /etc/profile.d
export MYSQL_HOME=/usr/local/mysql:/usr/local/mysql/bin
export PATH="${PATH}:${MYSQL_HOME}"
echo $PATH

that did the trick.

Thanks all;


All times are GMT -5. The time now is 12:09 PM.