[linux] bash vs command line

Günther Mittermayer g_mitter at web.de
Mon Sep 8 01:55:45 PDT 2003


Thanks to all for the info on bash..
it's amazing how pages of tutorials/howtos couldn't answer me these simple questions..
(well, as one might say, everything is simple, once you know it...)

my script is already alive and kicking.. thanks again.

Günther.

Linux/Unix Users Group at the UW <linux at u.washington.edu> schrieb am 05.09.03 16:48:25:

>

> 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:

>

> #!/bin/bash

> export VAR=50

> /usr/local/bin/my_program

>

> 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...

>

> --russell

> ----- 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:

>

> #!/usr/bash

> VAR="50"

> 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,

>

> Günther.

> ____________________________________________________________________________

> __

> 38xTestsieger - WEB.DE FreeMail - Deutschlands beste E-Mail

> zum Patent angemeldetem 3-Wege-Spam-Schutz- http://f.web.de/?mc=021130

>

>



______________________________________________________________________________
38xTestsieger - WEB.DE FreeMail - Deutschlands beste E-Mail.
Immer verfuegbar mit POP3, IMAP, SMTP, WAP - http://f.web.de/?mc=021135



More information about the Linux mailing list