Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- function usage() {
- echo "tmx <session>"
- }
- sess=${1:-def}
- running_sessions=$(tmux list-sessions | cut -d: -f 1)
- found=false
- for s in ${running_sessions};
- do
- if [[ "${s}" = "${sess}" ]]; then
- found=true
- fi
- done
- if [[ "${found}" = "true" ]]; then
- exec tmux attach-session -t "${sess}"
- else
- exec tmux new-session -s "${sess}"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement