csh script interruptability
utzoo!decvax!microsof!fluke!jeff
utzoo!decvax!microsof!fluke!jeff
Thu Nov 11 23:07:27 AEST 1982
Suppose you invoke vi from within a csh script, and suppose that you send
an intr signal (usually ^C or `#') to abort the script while you're in vi.
Surprise!
- Vi drops into the background and develops an enormous appetite for
cpu cycles.
- Your terminal characteristics are munged up.
Question of the day:
How to undo this mess? You can catch the signal within the
script and try to put things back in order. But why can't you kill vi?
For example:
#! /bin/csh -f
onintr egress # Catch them signals and head for the egress.
vi foo # Now give a ^C to vi and you'll land
egress: # here...
reset # Un-mung the terminal.
echo 'aborting' # This is important - you'll see later.
jobs # Shows vi chugging away...
kill -9 %vi # This ought to blast it.
echo $status # Shows that kill ``worked'', but...
jobs # it's still there!
Now you can alter the behavior in significant and interesting ways by changing
the echo statement!
Exercise 1: Change ``echo ...'' to ``/bin/echo ...''. Why does this keep vi
from going bonkers? Note that this doesn't fix everything. Would you say
this is an improvement?
P.S. I don't want to place all the blame on vi - you can substitute other
interesting programs as well - such as mail(1). (Hmmm... what gives, Berkeley?)
- jeff stearns, john fluke mfg co., everett wa
...!decvax!microsoft!fluke!jeff
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list