[linux] bash vs command line

Russell Power rjpower at u.washington.edu
Fri Sep 5 07:48:10 PDT 2003

Subshells can't affect the environment of parent shells (oh... I suppose
they *could*, but I haven't seen it done).

If your script looks like:

export VAR=50

Then my_program will have VAR=50 in it's environment, however when the
script finishes executing and you get back to your original shell, VAR will
either not exist, or have it's previous value. So as long as you execute
your program within the script, you'll be fine.

Hope that makes some amount of sense...

----- Original Message -----
From: "Günther Mittermayer" <g_mitter at web.de>
To: <linux at u.washington.edu>
Sent: Friday, September 05, 2003 8:21 AM
Subject: [linux] bash vs command line

Hi all..

I need to create a couple of enviroment variables everytime I need to run
some application.
Instead of just typing the "exports" in the command line, I tryied creating
a bash file to help me, but what seemed so simple is driving me crazy.

on the command line it works fine, but on a bash file not.. for example:

$> export VAR=50
$> echo $VAR

shows me the 50 with no problems... but if I do it in a bash file like that:

echo $VAR
export VAR

I run the script and it shows the 50 (because of the echo $VAR line), but
again on the command line:
$> echo $VAR

won't give me anything, as if the variable simply isn't defined.....
I am confused... what am I doing wrong??

thanks for any ideas,

38xTestsieger - WEB.DE FreeMail - Deutschlands beste E-Mail
zum Patent angemeldetem 3-Wege-Spam-Schutz- http://f.web.de/?mc=021130

More information about the Linux mailing list