* Passing Environment Variables
@ 1995-03-16 21:16 Alan Simon
1995-03-20 20:50 ` Gary Newman
0 siblings, 1 reply; 2+ messages in thread
From: Alan Simon @ 1995-03-16 21:16 UTC (permalink / raw)
I know that the export command passes variables from the shell down to
subshells. How do I pass a variable from a subshell back up to the original
shell?
-------------------------------------------------------------------------------
Alan Simon simon@hslc.org
Associate Director simon@shrsys.hslc.org
Health Sciences Libraries Consortium VOICE: (215) 222-1532
3600 Market Street, Suite 550 FAX: (215) 222-0416
Philadelphia, PA 19104
-------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Passing Environment Variables
1995-03-16 21:16 Passing Environment Variables Alan Simon
@ 1995-03-20 20:50 ` Gary Newman
0 siblings, 0 replies; 2+ messages in thread
From: Gary Newman @ 1995-03-20 20:50 UTC (permalink / raw)
Alan Simon (simon@shrsys.hslc.org) wrote:
: I know that the export command passes variables from the shell down to
: subshells. How do I pass a variable from a subshell back up to the original
: shell?
Strictly speaking, you can't do that in UNIX. However, you can have the
subshell echo a value to standard output, and store the output in a
variable in the parent shell using back-quotes. For example,
in the parent shell:
...
VALUE=`myscript arg1 arg2 ...`
echo VALUE is $VALUE
...
and in 'myscript':
...
echo "Return value"
exit 0
Or, just send different exit codes back to the parent, and test
the $status variable (cshell) or $? variable (bourne shell).
Hope this helps.
--
-------------------------------------------------------------------
Bill O'Keefe |Internet: bokeefe@xmx.com
XMX Corporation |
46 Manning Road |Telephone: (508)670-8444
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1995-03-20 20:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-03-16 21:16 Passing Environment Variables Alan Simon
1995-03-20 20:50 ` Gary Newman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox