Skip to content

Instantly share code, notes, and snippets.

@timonv
Created February 3, 2016 17:45
Show Gist options
  • Save timonv/97712de7e78cc6532183 to your computer and use it in GitHub Desktop.
Save timonv/97712de7e78cc6532183 to your computer and use it in GitHub Desktop.
function c() {
if [[ -n $(tmux list-sessions | awk '{print $1}' | grep $1) ]]; then
tmux switch-client -t $1
elif [[ -n $TMUX ]]; then
tmux switch-client -t "$(TMUX= tmux -S "${TMUX%,*,*}" new-session -dPs "$1")"
else
tmux new-session -s "$1"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment