Created
February 27, 2014 04:06
-
-
Save ryankanno/9244195 to your computer and use it in GitHub Desktop.
Tmux helper to list tmux sessions, attach to an existing session, or create a brand new one!
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
function tm() { | |
if [ -n "$1" ]; then | |
tmux attach -t $1 2>/dev/null || tmux new -s $1 | |
else | |
tmux list-sessions 2> >(grep -q 'failed') | |
if [ "$?" -eq 1 ]; then | |
echo "No available tmux sessions. Please create one." | |
fi | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment