blob: 5a3f2a865569f28d86a5a67620d846e217bfc706 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#
# Worktemux: tmux session wrapper
# https://robots.thoughtbot.com/a-tmux-crash-course
#
# Default options.
opts=""
# Session selection.
if [ ! -z "$1" ]; then
if tmux list-sessions 2> /dev/null | grep -q "^$1:"; then
tmux attach -t $1
exit $?
else
session="new -s $1"
fi
if [ "$1" == "root" ]; then
sudo tmux attach
exit
elif [ -f "$HOME/.tmux/$1" ]; then
opts="-f $HOME/.tmux/$1"
elif [ -f "$HOME/.tmux/base" ]; then
opts="-f $HOME/.tmux/base"
else
opts=""
fi
fi
# Start session.
tmux $opts $session
|