Setting variables for a running process
Peter Curran
peterc at ecr2.UUCP
Mon May 27 19:16:52 AEST 1985
Here is a scheme for getting environment changes back to your "main"
shell (this works for /bin/sh. I presume masochists could find
something similar in csh):
Add the following three lines to your .profile file:
trap '. $SHCMDS; rm -f $SHCMDS' 8
SHCMDS=$HOME/shcmds SHPID=$$
export SHCMDS SHPID
Then, in suprocess, write shell commands into the file named in $SHCMDS,
and send signal 8 to the process identified by $SHPID. For example,
in a shell script
echo "TERM=$TERM; export TERM" >$SHCMDS
signal -8 $SHPID
It is probably preferably that the '>' be '>>' to allow several
commands to be written out at once. This will fail if you push
it too hard - the shell has to get time to execute the commands
before another command is issued. However, it can be used for
all sorts of tricks.
More information about the Comp.unix
mailing list