Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 02-14-2004, 11:56 AM   #1
Registered: Aug 2003
Location: Rochester, MN, U.S.A
Distribution: Gentoo
Posts: 987

Rep: Reputation: 30
bash question

If I want to set a variable permantly by placing it in one of my files: ..bashrc or .bash_profile, Do I need the export command? Or is this just used if I need to export something temporarely.

PATH=$PATH:/home/shane ; export PATH
is the second part export PATH really needed?

TEST=/usr/bin/local/test ; export TEST
is export TEST really needed? It seems to work without it, but documentation I read tells me to use it

Last edited by shanenin; 02-14-2004 at 12:16 PM.
Old 02-14-2004, 12:16 PM   #2
LQ Guru
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
I'm fairly sure the 'export' part needs to be there; otherwise, the value of those variables disappears when the script is done running. If you want $PATH or $TEST available outside of that .bashrc or .bash_profile script, they need to be exported.
Old 02-14-2004, 06:07 PM   #3
LQ Addict
Registered: Dec 2003
Location: Maine, USA
Distribution: Slackware/SuSE/DSL
Posts: 1,320

Rep: Reputation: 45
I think it depends on how your system is set up. I'm not sure why, but I've never used "export" and have everything, including environment variables, in my .bashrc and never had trouble.
Old 02-14-2004, 06:10 PM   #4
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
If the script that you put it in is sourced, the variables will be live in the calling script, but use export anyway.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
A question about BASH operand Linux - Newbie 2 11-27-2005 09:49 PM
Bash Question mbjunior99 Programming 5 08-31-2005 04:33 AM
a bash question about while jiawj Linux - Newbie 3 07-14-2005 11:45 AM
bash question? shanenin Linux - Software 1 11-26-2004 12:22 PM
BASH question tpe Linux - Software 6 11-17-2004 08:59 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:44 AM.

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