🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #101

Re: setting variable from script to current environment??

#101
From: Stephen Riehm
Date: Wed, 22 Jul 1992 14:33
36 lines
1853 bytes
wayne@gbrmpa.gov.au (Wayne Amisano) writes:

>I am trying to write a script to set an environment variable in
>my tcsh environment.  I could use an alias to do it, but would
>much rather do it from a script.  What i need to do is, run a
>script to change the value of one environment variable, but
>every time i do this, it changes the variable in the spawned
>process, but it then disappears when it dies.

if it is not possible to use an alias, ( because it is too complex or
whatever ), try the following:

create your shell script
create an alias along the lines of:
	alias <alias> 'source <script>'

where <alias> and <script> are substituted with reasonable values.
This will solve your problem, because the current process runs the
script, and not a subshell!

>-- 
>Wayne Amisano (VK4KT)     _-_|\\    E-Mail - wayne@gbrmpa.gov.au
>Great Barrier Reef       /     \\   Phone  - +61 77 81 8861 (GMT+1000)
>Marine Park Authority.   \_.-._/    Fax    - +61 77 72 6093
>Our's to use Wisely!          v     Mail   - GPO Box 1379, Townsville QLD 4810

Finally one of those character piccies of Aus. Wish I had one! ;-)

catchya

-----------------------------------------------------------------
Stephen Riehm				   smr@pki-nbg.philips.de
not in any way talking on behalf of:
Philips Kommunikations Industrie	  Phone: +49 911 526 2975
8500 Nuremberg, Germany			    Fax: +49 911 526 2095
I come from the land down under, where women glow and men chunder
Technical Details
Message-ID: <smr.711815589@hitkw14>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!unido!pki-nbg!hitkw14!smr
References: <1992Jul21.070212.16485@gbrmpa.gov.au>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!unido!pki-nbg!hitkw14!smr
From: smr@iti.org (Stephen Riehm)
Newsgroups: comp.unix.shell
Subject: Re: setting variable from script to current environment??
Message-ID: <smr.711815589@hitkw14>
Date: 22 Jul 92 14:33:09 GMT
References: <1992Jul21.070212.16485@gbrmpa.gov.au>
Sender: news@pki-nbg.philips.de
Lines: 36