-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtmux_smpl.sh
72 lines (54 loc) · 1.44 KB
/
tmux_smpl.sh
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
################################
######## LIST SESSIONS #########
################################
SESSIONS=( $(
tmux list-sessions |
while read -r line
do
echo "$line" | sed 's/:.*//'
done
))
#echo "${SESSIONS[@]}"
length=${#SESSIONS[@]}
echo "#running sessions: $length"
for ((i = 0 ; i < $length ; i++)); do
echo "[$i] ${SESSIONS[$i]}"
done
################################
######## SELECT SESSION ########
################################
echo "Select session to load: "
read session_id
echo "Selected session: ${SESSIONS[$session_id]}"
tmux attach-session -t ${SESSIONS[$session_id]}
################################
######### NEEW SESSION #########
################################
#tmux new -s my_session
################################
############ TESTING ###########
################################
# declare -a NAME # explicitly declare array
# counter=0
# SESSIONS=( $(
# tmux list-sessions |
# while read -r line
# do
# echo "$line"
# #echo "["$counter"] $line"
# #NAME[$counter]="$(echo "$line" | sed 's/:.*//')"
# #NAME+=$(echo "$line" | sed 's/:.*//')
# #my_array+=("$line")
# #my_array[$counter]="value2"
# #counter=$((counter+1))
# done
# ))
# echo "Select session to load: "
# #read session_id
# #echo "Selected session ${NAME[$session_id]}"
# length=${#NAME[@]}
# echo "Running Sessions: $length"
# my_array+=(baz)
# echo "${my_array[@]}"
# echo "${SESSIONS[@]}"