Skip to content

Instantly share code, notes, and snippets.

@fzerorubigd
Created May 27, 2014 07:32
Show Gist options
  • Save fzerorubigd/aa7d26eb7e9152bb13d5 to your computer and use it in GitHub Desktop.
Save fzerorubigd/aa7d26eb7e9152bb13d5 to your computer and use it in GitHub Desktop.
Attach to any old TMUX on exit if its not a tty (only in pty and anything else)
# TMUX
if [ -z `tty | grep tty` ] ; then
if which tmux 2>&1 >/dev/null; then
# if no session is started, start a new session
test -z ${TMUX} && tmux
# when quitting tmux, try to attach
while test -z ${TMUX}; do
tmux attach || break
done
fi;
fi;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment