Created
June 9, 2014 08:40
-
-
Save fzerorubigd/cb8252a7d60f9638cea5 to your computer and use it in GitHub Desktop.
run tmux in all emulated tty and attach to them when exiting the shell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
echo "Press enter to attach to other tmux instanse, or anything then enter to just leave" | |
read attachto | |
if [ -z $attachto ]; then | |
tmux attach || break | |
else | |
break | |
fi | |
done | |
fi; | |
fi; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment