Set parent env with csh script

Guy Harris guy at auspex.UUCP
Tue Jan 10 05:14:47 AEST 1989


>Is it possible for a subshell to changes the calling shell's 
>environment?

Only if you can convince the calling shell to somehow take requests that
it change its environment from the subshell (there are no built-in
mechanisms in the C shell for this, so you'd have to play games with
some script reading input from the child shell and using "eval" or
somesuch to set its environment.  UNIX processes do not have the ability
to modify their parent shell's environment (in the UNIX sense of
"environment").

If your script just sets some environment variables, you might want to
consider running it with the "source" command (C shell) or the "."
command (Bourne/Korn shell); this causes the commands in the script to
be executed in the *same* process, rather than in a child process.  You
might be able to use aliases to syntactically sugar-coat this, if
desired....



More information about the Comp.unix.wizards mailing list