LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-01-2008, 09:00 PM   #1
garyg007
Member
 
Registered: Aug 2008
Location: north-east ohio
Distribution: Debian-squeeze/stable;
Posts: 279
Blog Entries: 1

Rep: Reputation: 31
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
Code:
PATH=$PATH:/stuff/I/added
and
Code:
export PATH=$PATH:/stuff/I/added
and
Code:
export PATH=all/the/old/stuff:stuff/I/added
nothing keeps the changes across system re-starts.

How do I make this happen?


Gary
 
Old 12-01-2008, 09:06 PM   #2
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,367

Rep: Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843
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.
 
Old 12-01-2008, 09:57 PM   #3
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
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/local.sh
chmod +x /etc/profile.d/local.sh
mcedit /etc/profile.d/local.sh

Then add your new PATH variable as you desire:

PATH=$PATH:blah:blah
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
 
1 members found this post helpful.
Old 12-01-2008, 11:12 PM   #4
garyg007
Member
 
Registered: Aug 2008
Location: north-east ohio
Distribution: Debian-squeeze/stable;
Posts: 279

Original Poster
Blog Entries: 1

Rep: Reputation: 31
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

Gary
 
Old 12-02-2008, 02:00 AM   #5
acummings
Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 615

Rep: Reputation: 50
Code:
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)

Alan.
 
Old 12-03-2008, 07:06 PM   #6
garyg007
Member
 
Registered: Aug 2008
Location: north-east ohio
Distribution: Debian-squeeze/stable;
Posts: 279

Original Poster
Blog Entries: 1

Rep: Reputation: 31
I added this text file to /etc/profile.d;
Code:
!/bin/sh
#
# this is located in /etc/profile.d
#
export MYSQL_HOME=/usr/local/mysql:/usr/local/mysql/bin
echo $MYSQL_HOME
export PATH="${PATH}:${MYSQL_HOME}"
echo $PATH
that did the trick.

Thanks all;

Gary
 
  


Reply

Tags
system, variables



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
howto set system-wide environment variables permanently in debian vineet7kumar Linux - Newbie 2 05-08-2008 06:39 PM
where to put system-wide environment variables otoomet Linux - Software 2 01-07-2008 07:06 AM
Bash: Saving and Variables morrolan Linux - Newbie 1 03-20-2006 11:03 AM
How to make system wild environment variables? renshao Linux - Newbie 5 03-12-2006 05:50 AM
System wide Environment variables Steave Linux - General 1 02-08-2002 05:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration