-
Notifications
You must be signed in to change notification settings - Fork 1
/
tmux-start
executable file
·36 lines (33 loc) · 907 Bytes
/
tmux-start
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
32
33
34
35
36
#!/bin/bash
export PATH=$PATH:/usr/local/bin
#echo "$$ $PPID"
#ps lwwwwp $$,$PPID
#set
# abort if we're already inside a TMUX session
[ "$TMUX" == "" ] || exit 0
# startup a "default" session if none currently exists
# we call ours "main"
tmux has-session -t main &>/dev/null || tmux new-session -s main -d
# present menu for user to choose which workspace to open
PS3="Please choose your session: "
options=($(tmux list-sessions -F "#S") "NEW SESSION" "BASH")
echo "Available sessions"
echo "------------------"
echo " "
select opt in "${options[@]}"
do
case $opt in
"NEW SESSION")
read -p "Enter new session name: " SESSION_NAME
exec tmux new -s "$SESSION_NAME"
break
;;
"BASH")
bash --login
break;;
*)
exec tmux attach-session -t $opt
break
;;
esac
done