Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 12-10-2005, 11:18 PM   #1
LQ Newbie
Registered: Nov 2005
Posts: 19

Rep: Reputation: 0
Shell variables

Whats the difference between:



export a=10

Cheers, Milosevic.
Old 12-10-2005, 11:31 PM   #2
Senior Member
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
The two 'a' variables here will have different scope; the first is a local variable, the second is an environmental variable.
Old 12-10-2005, 11:32 PM   #3
LQ Guru
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
a=10 assigns the value "10" to the shell variable "a".

export "a=10" assigns the value ... and propagates that value to any child shells.

Use "export" whenever you want a variable to be accessible to any subshells of your script.

You can find more details here:

anomie and I apparently clicked "send" almost simultaneously (hence this edit). Lest there be an confusion - we're both saying pretty much the same thing.

Last edited by paulsm4; 12-10-2005 at 11:35 PM.


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
Sub shell environment variables tnine9 Programming 1 06-08-2004 02:27 PM
Why?? can not use variables with shell script Bassam Linux - General 9 01-27-2004 08:42 AM
Setting Shell variables tmoorman Linux - Software 6 11-19-2003 04:41 PM
Shell Variables. ducka Programming 5 09-03-2003 06:38 PM
Makefiles and shell variables Snabber Linux - Software 1 08-06-2003 12:23 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:48 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration