LinuxQuestions.org
Review your favorite Linux distribution.
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 11-23-2004, 02:04 PM   #1
Ed_999
LQ Newbie
 
Registered: Sep 2004
Distribution: Slackware RedHat Fedora
Posts: 27

Rep: Reputation: 15
Slackware 10 Environment Variables Disappear!


Slackware 10 as root
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
adds the enviromental variable, but the next time I
reboot, it's gone! env | more shows it's not there no more.
How do I add an environmental variable permanently
to Slackware 10?
I also noticed that Slackware 10 does not have a
/root/.bashrc or /root/.bash_profile or /etc/.bashrc
So, where does Slackware 10 store it's environmental
variables? Can I create my own /root/.bashrc or
/root/.bash_profile or are these now obsolete and
no longer allowed? I've got some aliases I'd like to
write for ls, cp, etc.
 
Old 11-23-2004, 02:13 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
variables will never persist, personally i'd be concerned if they did. if you want a .bashrc, you can create one, they're just not required.
 
Old 11-23-2004, 02:25 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Various ways ...

You could add that to root's
~/.bashrc or ~/.bash_login

You could add it to
/etc/rc.d/rc.local

You could (which is what I'd do) create
/etc/profile.d/pkg_conf.sh
Code:
#!/bin/bash
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig
chmod u+x /etc/profile.d/pkg_conf.sh

Why this last technique, even though it appears to be more
work than necessary? It saves me the hassles of touching
other scripts after an upgrade, and the next one, and the
next one .... :}


Cheers,
Tink
 
Old 11-23-2004, 02:34 PM   #4
tank728
Member
 
Registered: Sep 2003
Posts: 142

Rep: Reputation: 17
You can also add it to ~/.profile, and bash will also recognize it. But remember, /etc/profile.d/<name>.sh will be for the system, whereas a ~/.bash_login, ~/.bashrc, or ~/.profile will be for just your user.

-tank
 
Old 11-27-2004, 10:10 AM   #5
Ed_999
LQ Newbie
 
Registered: Sep 2004
Distribution: Slackware RedHat Fedora
Posts: 27

Original Poster
Rep: Reputation: 15
Thank you for your excellent advise! My problem
is now solved. I copied out that bash script and
placed it in /etc/profile.d/ and it works perfectly.
I had no idea there were all those scripts in /etc/profile.d/ !
I'm going to have to take a closer look at them, just
to see what I can learn from them. Thanks again!
 
  


Reply



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
environment variables slinky2004 Linux - General 4 11-26-2005 09:59 AM
environment variables nasht Linux - General 3 08-11-2005 02:12 PM
environment variables user_linux Linux - Newbie 3 06-15-2005 08:46 AM
environment variables naren Linux - Software 1 12-15-2004 06:44 AM
environment variables Prakhardeep Linux - Software 3 10-06-2004 03:30 AM

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

All times are GMT -5. The time now is 07:52 AM.

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