Using 'exit' in a Bourne shell script

P.J. Brand pjb at dutesta.UUCP
Tue Feb 2 01:52:20 AEST 1988


>From article <169 at mccc.UUCP>, by pjh at mccc.UUCP (Peter J. Holsberg):
> 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.
> 
> 		echo "OFF \c:" >> /usr/.logins
> 		who am i >> /usr/.logins
> 		exit
> 
> The correct entries appear in /usr/.logins, but 'exit' seems to be
> ignored.  Typing 'exit' at the prompt does in fact do what I want --
> i.e., act as a substitute for ^d.  I see that exit(2) is a system call
> that terminates the calling process.  Oh oh!  It terminates 'off' but
> doesn't log the user off!  Rats!@!@#$%
> 
> Can anyone suggest a way (SysVr3.0) to do what I want?  Thanks.
> .
> 
> -- 

The script would work if your users would call:

	. /usr/local/off

or wherever your script is stored.
But, instead, you would probably prefer to use:

	kill -9 0

instead of the exit, to make the script work as expected.


==============================================================================
Paul Brand
Delft University of Technology         INTERNET : karel at dutesta.UUCP
Faculty of Electrical Engineering      UUCP     : ..!mcvax!dutrun!dutesta!karel



More information about the Comp.unix.questions mailing list