Run a logout script in k-shell

By setting trap one can run a logout script when a k-shell is being terminated. The built-in command trap in k-shell allows one to customize shell when a signal is received.

# Set to run $HOME/.logout script when shell is terminated
$ trap ‘. $HOME/.logout’ 0
# display list of signals setup
$ trap
trap — ‘. $HOME/.logout’ EXIT

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s