Path: utzoo!yunexus!maccs!dan From: dan@maccs.McMaster.CA (Dan Trottier) Newsgroups: comp.unix.questions Subject: Re: Using exit in a Bourne shell script Message-ID: <1335@maccs.McMaster.CA> Date: 26 Jul 88 12:32:14 GMT Article-I.D.: maccs.1335 References: <16540@brl-adm.ARPA> Reply-To: dan@maccs.UUCP (Dan Trottier) Organization: McMaster U., Hamilton, Ont., Can. Lines: 37 In article <16540@brl-adm.ARPA> iunix1@almsa-1.arpa (Will Martin) writes: >Back in February, there were some Info-UNIX discussions under the above >subject regarding methods of replacing the normal CTRL-D logoff with >a special script or procedure. One of the contributors mentioned this: > >> From: Kathy Vincent >> >> trap '$HOME/.logout' 0 >> >> Which is to say, "when you receive the logoff signal, execute $HOME/.logout >> first and THEN log off." > >Anybody have any advice on this subject? Is there a clean way to do what >I want? Or even a dirty way -- I'm pretty sloppy... :-) Can a script >executed at the "trap 0" point get back to the shell where the signal >originated, or is it too late by then? If so, could it cause another >top-level shell to be spawned, keeping all the environment I had before? Here is how we do this around here. You must remember that your .login file is read after reading your .cshrc file at login. In you .login file you place the following "set ignoreeof" and in your .cshrc file you place "unset ignoreeof". So at login the ignoreeof will be set by your .login file and thus will prevent you from loging out via a ctrl-D. If you start a new sub-shell the .cshrc file is read and the "unset ignoreeof" will allow you to use ctrl-D to exit that shell. Sorry if this has already been answered. dan -- A.I. - is a three toed sloth! | ...!uunet!mnetor!maccs!dan -- Official scrabble players dictionary -- | dan@mcmaster.BITNET