Skip to content

Instantly share code, notes, and snippets.

@AlexanderS
Created October 12, 2017 20:18
Show Gist options
  • Save AlexanderS/228a43b235550a42d721011c656cfcf9 to your computer and use it in GitHub Desktop.
Save AlexanderS/228a43b235550a42d721011c656cfcf9 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
if [[ "x$1" == x ]] ; then
\tmux list-sessions || \tmux new-session -d
exec \tmux attach-session -d
fi
if [ -z "$2" -a "$1" != "att" -a "$1" != "ls" ]; then
if \tmux has-session -t "$1"; then
exec \tmux attach-session -t "$1"
else
exec \tmux new-session -s "$1"
fi
fi
exec \tmux "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment