Last active
August 29, 2015 14:22
-
-
Save vsnguyen/f23b06f2b8d63c0343f4 to your computer and use it in GitHub Desktop.
Quickly create and attach to a tmux session
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
#!/bin/bash | |
function tmux-attach(){ | |
SESSION_NAME=$1 | |
tmux attach -t $SESSION_NAME | |
} | |
function tmux-new(){ | |
SESSION_NAME=$1 | |
tmux new -s $SESSION_NAME | |
tmux-attach $SESSION_NAME | |
} | |
function tmux-fn(){ | |
tmux has-session -t ${PWD##*/} 2>/dev/null | |
if [ $? -eq 1 ] | |
then | |
tmux-new ${PWD##*/} | |
else | |
tmux-attach ${PWD##*/} | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment