]> git.huck.website - zshmux.git/commitdiff
fixed: failing if only one session not attached main
authorHuck Boles <huck@huck.website>
Sat, 6 Apr 2024 22:56:07 +0000 (15:56 -0700)
committerHuck Boles <huck@huck.website>
Sat, 6 Apr 2024 22:56:07 +0000 (15:56 -0700)
zshmux.sh

index b8041a0ac5bd73425a668ad2859fc5425c26bf79..4fe2bbe1d481d574a6cde4474552bf938273a971 100644 (file)
--- a/zshmux.sh
+++ b/zshmux.sh
@@ -9,7 +9,7 @@
 # check if any sessions exit
 if [[ $(tmux list-sessions | wc -l) -ne 0 ]]; then
     if [[ $(tmux list-sessions -F"#{?session_attached,,x}" | grep -c "x" ) -eq 1 ]] && [[ -z $SSH_CLIENT ]]; then
 # check if any sessions exit
 if [[ $(tmux list-sessions | wc -l) -ne 0 ]]; then
     if [[ $(tmux list-sessions -F"#{?session_attached,,x}" | grep -c "x" ) -eq 1 ]] && [[ -z $SSH_CLIENT ]]; then
-        tmux attach-session -t "$(tmux list-sessions -F"#{?session_attached,,#S}"  )"
+        tmux attach-session -t "$(tmux list-sessions -F"#{?session_attached,,#S}" | xargs echo )"
         return
     else
         printf '\033[32;1mcurrent \033[33;1mtmux \033[32;1msessions\033[0m:\n'
         return
     else
         printf '\033[32;1mcurrent \033[33;1mtmux \033[32;1msessions\033[0m:\n'