bin/tmuxs

changeset 448
12d2866f8190
child 473
049e9d356e16
equal deleted inserted replaced
447:8ef69d160a72 448:12d2866f8190
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

mercurial