.logout for ksh?

William E. Davidsen Jr davidsen at steinmetz.ge.com
Wed Oct 5 04:29:08 AEST 1988


In article <209 at dcs.UUCP> wnp at dcs.UUCP (Wolf N. Paul) writes:
| In article <1594 at mcgp1.UUCP> fst at mcgp1.UUCP (Skip Tavakkolian) writes:
| >Is there a way to execute something on exit, in Korn shell?
| >This would be like the ``csh'' ``.logout'' file.
| 
| I use a statement in /etc/profile to accomplish this:
| 
| trap ". $HOME/.logout.ksh" 1

  This is an excellent answer to the problem, but there is a way to make
it more flexible. In my .profile I have code like this:

	for n in 0 1 3 15
	do	trap ". $HOME/.logout $n" $n
	done

and my .logout starts with:

	TermSIG="$1"

This allows me to make some tests in the logout script which avoid
loops. When just doing a normal termination I ask if all terminals
logged in under my ID are to be logged out, to allow me a fast way to
end the day. Others will probably want to use other tests.
-- 
	bill davidsen		(wedu at ge-crd.arpa)
  {uunet | philabs}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me



More information about the Comp.unix.wizards mailing list