]> arthur.barton.de Git - ConfigScripts.git/blob - user/bash_logout
Use "type -t" to test for tools.
[ConfigScripts.git] / user / bash_logout
1 #
2 # ~/.bash_logout: executed by bash(1) on logout
3 # Written 2003-2014 by Alexander Barton (alex@barton.de)
4 #
5 # This script is executed by bash(1) on logout.
6 #
7 # PLEASE NOTE:
8 # To make this script generic, it sources ~/bash_logout.user if it exists.
9 # So you shouldn't make changes to this script, but create your own
10 # individual ~/bash_logout.user file!
11 #
12
13 [ -e ~/.ConfigScripts.debug ] && echo " >> ~/.bash_logout ..."
14
15 [ -r ~/.bash_logout.user ] && source ~/.bash_logout.user
16
17 # Clean up SSH agents, if running and not using keychain(1)
18 if [ $SSH_AGENT_PID ]; then
19         type -t keychain >/dev/null || eval `ssh-agent -k`
20 fi
21
22 # Clear the console if it is a local terminal
23 case `tty` in
24     /dev/tty[0-9]*|/dev/ttyS[0-9]*)
25         [ -x /usr/bin/clear_console ] && /usr/bin/clear_console --quiet || clear
26         ;;
27     *)
28         if [ -z "$SUDO_USER" ]; then
29                 echo "Bye, bye, $LOGNAME!"; echo
30         fi
31 esac
32
33 # -eof-