Sun, 18 Dec 2016 07:45:36 -0500
fix troublesome trail char
448 | 1 | #!/bin/sh |
2 | set -eu | |
3 | ||
4 | case ${1:-} in *help|-h) | |
5 | exec perldoc -T $0;; | |
6 | esac | |
7 | ||
8 | name=${1:-$(basename `pwd`)} | |
9 | ||
10 | if tmux ls -F '#S' | grep -x $name >/dev/null; then | |
11 | if [[ ${TMUX:-} ]]; then | |
12 | exec tmux switch-client -t $name | |
13 | else | |
14 | exec tmux attach -t $name | |
15 | fi | |
16 | else | |
17 | exec tmux new -s $name | |
18 | fi | |
19 | ||
20 | :<<=cut | |
21 | =head1 NAME | |
22 | ||
23 | tmuxs - Start or attach session based on cwd or given name | |
24 | ||
25 | =head1 SYNOPSIS | |
26 | ||
27 | tmuxs foobaz | |
28 | ||
29 | cd ~/proj/quux | |
30 | tmuxs | |
31 | ||
32 | =cut |