[Gllug] Run script on last logout

Jon Dye jon at pecorous.co.uk
Thu Jul 19 11:35:34 UTC 2007


>> Jon Dye wrote:
>>> I would like to run a command/script from my .bash_logout file
>>> but only when exiting the last login to the machine (by that
>>> user). Can anyone suggest a way of detecting the last logout (or
>>> an alternative from using .bash_logout)?

[...]

Alain Williams wrote:
> This is better:
> 
> 	(( $( who | grep -c "^$USER " ) > 1 )) && echo yes || echo no
> 

Marvellous, that worked a treat, thanks.

JD

-- 
"I did a bit of Latin in my time. But I can control it."
		- Eddie Izzard

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 257 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20070719/0ca8c08a/attachment.pgp>
-------------- next part --------------
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list