Set parent env with csh script

Christoph Kuenkel ckl at uwbln.UUCP
Tue Jan 10 05:22:47 AEST 1989


In article <9314 at smoke.BRL.MIL>, gwyn at smoke.BRL.MIL (Doug Gwyn ) writes:

> [...]
> SOURCING a shell script (as opposed to EXECUTING it) causes the
> changes to occur in the invoking shell context (as opposed to
> a subprocess context).  Thus you can alter environment variable
> via a sourced script that does setenv (or Bourne shell equivalent).

Unfortunately, csh doesn't get it right since it does not evaluate $path
to lookup the file to be sourced (at least on my SysV based system).
Therefore, the location of the script is not transparent to the user as it
is in the case of an executed shell script.  
Bourne shell does it right, but attention, in

	while <expr>; do
		<stmnt>
	done <io redirection>

<stmnt> is executed in a ``subrocess context'' due to the io redirection!
So any variable assignement and/or environment setting is uneffective outside
the while-loop.
Any elegant solution to that?

christoph
-- 
# include <std/disclaimer.h>
Christoph Kuenkel/UniWare GmbH       Kantstr. 152, 1000 Berlin 12, West Germany
ck at tub.BITNET                ckl at uwbln             {unido,tmpmbx,tub}!uwbln!ckl



More information about the Comp.unix.wizards mailing list