Using 'exit' in a Bourne shell script

Lawrence F. Strickland larry at jc3b21.UUCP
Tue Feb 2 23:17:27 AEST 1988


in article <1062 at bakerst.UUCP>, kathy at bakerst.UUCP (Kathy Vincent) says:
> 
> In article <169 at mccc.UUCP> pjh at mccc.UUCP (Peter J. Holsberg) writes:
>>I would like to have my users logout via a shell script "off" rather
>>than with ^d.  The script I wrote is very simple, but 'exit' has no
>>effect. ...
> 
> 	trap '$HOME/.logout' 0

As you mentioned, exit will only get you out of the script, not the
enwrapped shell.  I've always had good luck with:

	kill -9 0

in a shell script.  This is a bit rough (as it kills ALL programs associated
with the terminal, including background ones), but it has to be since a
normal kill is ignored by the shell.  I'm sure there is a better way, too...
-- 
+--------------------------------------+-- St. Petersburg Junior College --+
|        Lawrence F. Strickland        |   P.O. Box 13489                  |
| ...gatech!codas!usfvax2!jc3b21!larry |   St. Petersburg, FL 33733        |
+-(or) ...gatech!usfvax2!jc3b21!larry -+-- Phone: +1 813 341 4705 ---------+



More information about the Comp.sys.att mailing list