|
@@ -1,13 +1,14 @@
|
1
|
1
|
#!/bin/sh
|
2
|
2
|
#
|
3
|
|
-SESSION=$(tmux ls -F "#{session_name}")
|
4
|
3
|
|
5
|
|
-echo $NEW
|
|
4
|
+for s in $(tmux list-sessions -F '#{session_name}'); do
|
|
5
|
+ p=$(tmux list-panes -F '#{pane_tty}' -t "$s")
|
|
6
|
+ if [ "$p" = "$(tty)" ]; then
|
|
7
|
+ # Session already running
|
|
8
|
+ exit 0
|
|
9
|
+ fi
|
|
10
|
+done
|
6
|
11
|
|
7
|
|
-if [ "$SESSION" = "" ]; then
|
8
|
|
- tmux attach-session -t default_ssh || tmux new-session -s default_ssh
|
9
|
|
-else
|
10
|
|
- echo tmux-session \"$SESSION\" already running.
|
11
|
|
-fi
|
|
12
|
+tmux attach-session -t default_ssh || tmux new-session -s default_ssh
|
12
|
13
|
|
13
|
14
|
|