.bash_logout 534 B

1234567891011121314
  1. # don't leave behind any stray ssh sessions - kill them when bash exits,
  2. # unless it was running inside a tmux session (but the idea is to kill
  3. # ssh sessions running inside tmux!)
  4. if [ -n "${SSH_CONNECTION}" -a -z "${TMUX}" ]; then
  5. for ssh_host in $(grep 'Host\b' .ssh/config|cut -f2 -d' ') ; do
  6. ssh_pid=$(ps u|awk "/ssh ${ssh_host}/ && !/grep/{print $2}")
  7. [ -n "${ssh_pid}" ] && kill ${ssh_pid} 2>/dev/null
  8. done
  9. fi
  10. if [ "$SHLVL" = 1 ]; then
  11. [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
  12. fi