# 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'