From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from po3.andrew.cmu.edu ([128.2.12.31]) by archone.tamu.edu with SMTP id <18892>; Sun, 29 Dec 1991 04:55:11 -0600 Received: by po3.andrew.cmu.edu (5.54/3.15) id for rc@archone.tamu.edu; Sun, 29 Dec 91 05:55:02 EST Received: via switchmail; Sun, 29 Dec 1991 05:55:01 -0500 (EST) Received: from mycroft.bh.andrew.cmu.edu via qmail ID ; Sun, 29 Dec 1991 05:53:53 -0500 (EST) Date: Sun, 29 Dec 1991 04:53:48 -0600 From: "Julian L. Ho" Subject: builtin exit To: rc@archone.tamu.edu Message-Id: <694002955.8576.0@mycroft.bh.andrew.cmu.edu> It would be nice if exit took strings like 'sigint', etc... just a single string (a list like return handles wouldn't be possible, I know). It would also be nice if signal handlers had some way of telling how they were called (I'm thinking setting $status on entry to signal handlers, or possibly $*, to some meaningful string). For example, I'd like something like this to work: pipes=() fn sigexit sigint sigquit { s=$status { rm $pipes exit $s } } #code that builds $pipes (list of files) and does things with #it The idea is to have the script exit with 'sigint', 'sigquit', the argument to builtin exit (if its used), or the exit status of the last command (if we just fall off the end in "code...")... Currently, I'm doing something like: pipes=() fn sigint sighup sigquit { rm $pipes exit 1 } #code... # Normal exit follows (a copy of the cleanup code in the handler) rm $pipes But that only works because my code doesn't call builtin exit in the middle... also, exiting with the exit status of the cleanup code (rm in this example) isn't necessarily correct. If the user causes an interrupt, the cleanup actions are taken but the exit status is 1, not 'sigint', or whatever...