[comp.unix.questions] Interrupting only one command from a sequence

pjs@euclid.jpl.nasa.gov (Peter Scott) (11/17/90)

I would like to be able to execute an alias that equates
to a sequence of commands, e.g. "a; b; c; d" so that
typing ^C while a is executing causes execution to proceed
to b, instead of terminating the whole sequence.  I'd also
like to revert to the normal behavior upon completing the
command sequence.  Any ideas?


-- 
This is news.  This is your       |    Peter Scott, NASA/JPL/Caltech
brain on news.  Any questions?    |    (pjs@euclid.jpl.nasa.gov)

news@usenet.ins.cwru.edu (11/17/90)

In article <1990Nov16.180822.1843@elroy.jpl.nasa.gov> pjs@euclid.jpl.nasa.gov writes:
>I would like to be able to execute an alias that equates
>to a sequence of commands, e.g. "a; b; c; d" so that
>typing ^C while a is executing causes execution to proceed
>to b, instead of terminating the whole sequence.  I'd also
>like to revert to the normal behavior upon completing the
>command sequence.  Any ideas?

Well, in bash or ksh you could do

alias abcd="a ; b ; c ; d"

Here's what I get with bash.

thor$ abcd
this is a
^Cthis is b
^Cthis is c
^Cthis is d
^Cthor$

Where a, b, c, and d are all links to the same shell script:

echo this is ${0##*/}
sleep 5

Chet
-- 
Chet Ramey				``I die, Horatio''
Network Services Group, Case Western Reserve University
chet@ins.CWRU.Edu
                My opinions are just those, and mine alone.