Setting variables for a running process

William Martin control at almsa-1.ARPA
Wed May 22 06:55:00 AEST 1985


A query regarding running under 4.2 BSD, and using the standard
"sh" shell:

Is there any way I can change my terminal type (setting the TERM variable)
while I am inside some other process? If I can do a "!sh" or push to a
lower fork or child process, and then run the shell and do a TERM=xyz
and export TERM, that only has an effect for that child process. Is there
a way to do it so that it changes the variable in the parent process,
where I am working?

For example, I get on a terminal not my usual one, forget to do a
TERM type setting, and then run "send", our message-sending routine
which is part of the mmdf mail system we use here. I compose the
message and then want to use "vi" to edit it. When I run "vi", the
screen display is all messed up because the TERM type is wrong.
I can :q out of vi, and use ed instead, which is what I do, but I
wonder if there is something I can do at that point to reset my
terminal type without saving the text data, aborting "send", and
then resetting and starting over? That is, terminate the mangled "vi",
do <something> that resets the terminal type to the correct one, and
then restart "vi" on the message text? (I would hope that there is some
generic method to do this -- I'm not looking for specific help regarding
this particular local mail tool.)

On a TOPS-20 machine, I can be running a process, give a "push" command
which spawns a lower-level running fork of the exec, and at that lower level
give terminal and environment-modification commands that are effective
AFTER I subsequently issue a "pop" command which takes me back up to
where I was when I did that "push".

Is there an equivalent in UNIX? Maybe something that has some sort of
"global" effect, or something like the way you can do ". shellscript"
to get the shellsript commands to affect your own personal running shell?
(This would reach UP an arbitrary number of levels.)

Will Martin

ARPA/MILNET: wmartin at almsa-1.ARPA    UUCP/Usenet: seismo!brl-bmd!wmartin



More information about the Comp.unix mailing list