Skip to content

Instantly share code, notes, and snippets.

@vsnguyen
Last active August 29, 2015 14:22
Show Gist options
  • Save vsnguyen/f23b06f2b8d63c0343f4 to your computer and use it in GitHub Desktop.
Save vsnguyen/f23b06f2b8d63c0343f4 to your computer and use it in GitHub Desktop.
Quickly create and attach to a tmux session
#!/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