Created
May 15, 2013 23:19
-
-
Save jenrzzz/5588205 to your computer and use it in GitHub Desktop.
tmux session switcher function
This file contains hidden or 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 sesh() { | |
| if [[ $# -gt 0 ]]; then | |
| case "$1" in | |
| new) | |
| tmux new -s "$2" | |
| ;; | |
| *) | |
| if tmux list-sessions | grep "attached"; then | |
| tmux switch -t "$1" | |
| else | |
| tmux attach -t "$1" | |
| fi | |
| ;; | |
| esac | |
| else | |
| (tmux list-sessions &>/dev/null && tmux list-sessions) || echo "No active sessions." | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment