LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-19-2011, 07:47 AM   #1
Ribo01
Member
 
Registered: Aug 2010
Posts: 103

Rep: Reputation: 5
export command help ?


Hello y'all. I would like to know what happens when you use the EXPORT command. Yeah, I know its works as the name sound maybe you want to make a change to a variable, like let. Say PS1, you make the change and you export it. The crux of my curiosity really is this, so to what file or where does the exported change really go, and why is the change not parmanent ? All this I would like answered and explained. Thanks distro is Red hat
 
Old 04-19-2011, 08:47 AM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Exporting a variable or function makes it available to any subshells that are spawned from that shell. When a subshell is opened, say when running a script or piped command, it makes a local copy of any variables that have the export flag set. Without exporting, it may only be available to the level where it was set (depending on what it is. I'm not sure about all the details).

http://www.tldp.org/LDP/abs/html/oth...sv.html#ENVREF
http://www.tldp.org/LDP/abs/html/int...html#EXPORTREF

All shell environment settings are held only in the memory dedicated to that process and so are lost when the shell closes. You can only make such things "permanent" by ensuring that your start-up scripts or spawning shells set them during initialization.

Last edited by David the H.; 04-19-2011 at 08:51 AM. Reason: added link and expanded explanation.
 
Old 04-19-2011, 09:39 AM   #3
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720
"export" does not save it to any kind of file, and it's not permanent.

It simply means that the variable will be made visible to processes spawned by the shell.
 
  


Reply


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
export command brgsousa Linux - Software 1 03-20-2010 08:10 PM
[SOLVED] export command deostroll Linux - Newbie 5 02-20-2010 07:55 AM
export command rohr Mandriva 1 04-11-2005 06:24 AM
BASH export command galalleni Slackware 4 09-08-2003 01:44 AM
Export Command choawk Linux - General 1 06-06-2003 02:26 AM


All times are GMT -5. The time now is 06:31 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration