tmux will create new window under current session(with bind-key c). I want to select session when create window.
This script works fine when run it directly, but fails when called from tmux using bind key
bind-key C run-shell '~/tmux/tmux.window.sh'. The output is 'tmux/tmux.window.sh' returned 1
#!/bin/sh
export PATH=$PATH:/usr/local/bin
# present menu for user to choose which workspace to open
PS3="option: "
options=($(tmux list-sessions -F "#S") "in new session" )
select opt in "${options[@]}"
do
    case $opt in
        "in new session")
            read -p "new session: " SESSION_NAME
            TMUX=  tmux new -s "$SESSION_NAME"
            break
            ;;
        *)
            tmux new-window -t ${opt}:
            tmux attach-session -t ${opt}
            break
            ;;
    esac
done