Skip to content

Instantly share code, notes, and snippets.

@spchamp
Created June 20, 2016 05:06
Show Gist options
  • Save spchamp/520456dbd609566f6aa18048f09d9a88 to your computer and use it in GitHub Desktop.
Save spchamp/520456dbd609566f6aa18048f09d9a88 to your computer and use it in GitHub Desktop.
.bash_logout
# .bash_logout -*- sh -*-
if [ -n "$SSH_AGENT_PID" ] &&
[ "$(ps -p $SSH_AGENT_PID -c -o comm | sed 1d)" = ssh-agent ] &&
[ "$(ps -U $USER -c -o tty | sed 1d | grep -v "^-" | sort | uniq)" -eq 1];
## Do not enter this branch of control flow
## if user is logged in under another PTY/TTY
then eval $(ssh-agent -k)
fi
## source: debian skel ${HOME}/.bash_logout
## logic: check BASH $SHLVL before xclearchars(...)
if [ "$SHLVL" = 1 ]; then
## dep: debian clear_console binary - source, Debian 'bash' package (?)
# [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
## dep: BSD Logic
clear
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment