Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to trap signals in csh script ?

1,442 views
Skip to first unread message

Pascal Riou

unread,
Nov 29, 1996, 3:00:00 AM11/29/96
to

Hello

In bourne shell, i can trap most of signals :

#! /bin/sh

trap "echo SIGINT and SIGTSTP are trapped ..." 2 24

clear
echo "Waiting ..."

while [ -z "" ]
do
:
done

In csh manual says that we can trap SIGINT signal with onintr command :

#! /bin/csh

onintr trap-STOP

clear
echo "Waiting ..."

loop:
while (1)
:
end


trap-STOP:
echo "SIGINT is trapped"
goto loop

Is it possible to trape another signal than SIGINT in a csh script ?

Thank you.
--
Pascal Riou
mailto:Pasca...@vz.cit.alcatel.fr
tel : (1) 01-30-77-33-48
Fax : (1) 01-30-77-83-15

Dave Brown

unread,
Nov 29, 1996, 3:00:00 AM11/29/96
to

In article <329EFD...@vz.cit.alcatel.fr>,
Pascal Riou <pasca...@vz.cit.alcatel.fr> wrote:
: Is it possible to trape another signal than SIGINT in a csh script ?

No.

A workaround is easy--just write all your scripts in Bourne shell. See
ftp://rtfm.mit.edu/pub/usenet/comp.unix.shell/Csh_Programming_Considered_Harmful
for more details.

--Dave

Brian S Hiles

unread,
Dec 3, 1996, 3:00:00 AM12/3/96
to

Pascal Riou (pasca...@vz.cit.alcatel.fr) wrote:
: Hello

: In bourne shell, i can trap most of signals :
: #! /bin/sh
: trap "echo SIGINT and SIGTSTP are trapped ..." 2 24
: clear
: echo "Waiting ..."
: while [ -z "" ]
: do
: :
: done
: In csh manual says that we can trap SIGINT signal with onintr command :
: #! /bin/csh
: onintr trap-STOP
: clear
: echo "Waiting ..."
: loop:
: while (1)
: :
: end
: trap-STOP:
: echo "SIGINT is trapped"
: goto loop
: Is it possible to trape another signal than SIGINT in a csh script ?
: Thank you.

Nope.

-Brian
--
,---. ,---. ,---. ,---. ,---. ,---. ,---.
/ _ \ / _ \ / _ \ / _ \ / _ \ / _ \ / _ \
.' / \ `.' / mailto:bsh2...@challenger.atc.fhda.edu \ `.' / \ `.
__,' `.___,' `.___,' `.___,' `.___,' `.___,' `.___,' `.__

0 new messages