Quick: Unix shell scripts, which sets environment vars

Peter Bateman shediac92@hotmail.com
Fri, 22 Aug 2003 14:29:06 -0300


The following was taken from:-

http://duplex.hypermart.net/books/bsd/201-202.html

"Exported variables exist in the environment space of the shell process. 
When the shell executes a new child process (subprocess) it passes the 
environment to the new process. The environment consist only of variables 
that have been exported. By using exported variables you can pass global 
information to any subprocess. Whether the environment is used by the 
subprocess depends on the subprocess.

Subprocesses cannot change the environment of a parent process. They can 
change their environment but the changes cannot be passed back to the 
parent."

Regards,
Peter Bateman



>From: Tim Cummings <tim.cummings@frequencymarketing.com>
>To: "'oh@scanconsult.dk'" <oh@scanconsult.dk>,   "'Rohde Dirk'" 
><Dirk.Rohde@vpgroup.com>
>CC: powerh-l@lists.swau.edu
>Subject: RE: Quick: Unix shell scripts, which sets environment vars
>Date: Thu, 21 Aug 2003 15:47:48 -0400
>
>Ole,
>
>In your script, after setting the environment variables, I think if you
>follow them with "export" commands, it will make those environment 
>variables
>available to the entire process tree.
>
>Tim Cummings
>
>
>-----Original Message-----
>From: Ole Hansen, ScanConsult [mailto:oh@scanconsult.dk]
>Sent: Thursday, August 21, 2003 2:21 PM
>To: 'Rohde Dirk'
>Cc: powerh-l@lists.swau.edu
>Subject: RE: Quick: Unix shell scripts, which sets environment vars
>
>Hi Dirk,
>
>Yes - of course Quick has already started a child process; thanks for
>pointing this out.
>
>I will have to let the script write the result to a file or a table in the
>database, where I can read it from Quick.
>
>Mange hilsner / With kind regards
>
>Ole Hansen
>
>===========================================================
>E-mail: oh@scanconsult.dk         Cell Phone: +45 4040 1150
>===========================================================
>ScanConsult IT-Partners ApS         Voice   : +45 8738 7474
>Jegstrupvej 96A                     Fax     : +45 8738 7475
>DK-8361 Hasselager         Support : support@scanconsult.dk
>Denmark                    Sales   :   sales@scanconsult.dk
>                  http://www.scanconsult.dk
>= ParaSuite :  A Suite of Air Cargo Handling solutions    =
>= ParaSafe  :  A Suite of IT-Security solutions           =
>= Partners  : Hewlett-Packard, Cognos, Microsoft and more =
>
>
>
>-----Original Message-----
>From: powerh-l-admin@cube.swau.edu [mailto:powerh-l-admin@cube.swau.edu] On
>Behalf Of Rohde Dirk
>Sent: 21. august 2003 17:41
>To: 'oh@scanconsult.dk'
>Cc: powerh-l@lists.swau.edu
>Subject: RE: Quick: Unix shell scripts, which sets environment vars
>
>
>I'm not sure what is causing the error (check your file protection), but I
>believe that Quick starts a child process for any "run command" procedure.
>Thus, even if you are able to "dot" a script, you would still lose the
>environment variables upon return. The solution is to either use the
>"setsystemval" command or to set and export your environment variables
>before starting Quick.
>
>-----Original Message-----
>From: Ole Hansen, ScanConsult [mailto:oh@scanconsult.dk]
>Sent: Thursday, August 21, 2003 3:10 AM
>To: powerh-l@lists.swau.edu
>Subject: Quick: Unix shell scripts, which sets environment vars
>
>
>Hi all,
>
>I need to execute a shell script from Quick, and retrieve the environment
>variables, set by the script.
>
>The script works and the variables is set in the calling process when run
>manually from the shell with a dot preceeding the scriptname (.
><scriptname>) but when I try from Quick using RUN COMMAND ". <scriptname>"
>it fails with an exit status of 126.
>
>It is the leading dot, that causes the error because when I try RUN COMMAND
>"<scriptname>", I get no errors - but the environment variables set by the
>script are of course not available to GETSYSTEMVAL afterwards.
>
>So I guess that my problem can be re-phrased to: How does one execute a
>shell command from Quick using the same shell instance as Quick runs in?
>
>Any help will be highly appreciated.
>
>Mange hilsner / With kind regards
>
>Ole Hansen
>
>===========================================================
>E-mail: oh@scanconsult.dk         Cell Phone: +45 4040 1150
>===========================================================
>ScanConsult IT-Partners ApS         Voice   : +45 8738 7474
>Jegstrupvej 96A                     Fax     : +45 8738 7475
>DK-8361 Hasselager         Support : support@scanconsult.dk
>Denmark                    Sales   :   sales@scanconsult.dk
>                  http://www.scanconsult.dk
>= ParaSuite :  A Suite of Air Cargo Handling solutions    =
>= ParaSafe  :  A Suite of IT-Security solutions           =
>= Partners  : Hewlett-Packard, Cognos, Microsoft and more =
>
>
>= = = = = = = = = = = = = = = = = = = = = = = = = = = =
>Mailing list: powerh-l@lists.swau.edu
>Subscribe: "subscribe" in message body to powerh-l-request@lists.swau.edu
>Unsubscribe: "unsubscribe <password>" in message body to
>powerh-l-request@lists.swau.edu
>http://lists.swau.edu/mailman/listinfo/powerh-l
>This list is closed, thus to post to the list you must be a subscriber. = =
>= = = = = = = = = = = = = = = = = = = = = = = = = = Mailing list:
>powerh-l@lists.swau.edu
>Subscribe: "subscribe" in message body to powerh-l-request@lists.swau.edu
>Unsubscribe: "unsubscribe <password>" in message body to
>powerh-l-request@lists.swau.edu
>http://lists.swau.edu/mailman/listinfo/powerh-l
>This list is closed, thus to post to the list you must be a subscriber.
>
>= = = = = = = = = = = = = = = = = = = = = = = = = = = =
>Mailing list: powerh-l@lists.swau.edu
>Subscribe: "subscribe" in message body to powerh-l-request@lists.swau.edu
>Unsubscribe: "unsubscribe <password>" in message body to
>powerh-l-request@lists.swau.edu
>http://lists.swau.edu/mailman/listinfo/powerh-l
>This list is closed, thus to post to the list you must be a subscriber.

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.  
http://join.msn.com/?page=features/virus