there is an answer here about tmux using wait-for and LocalCommand to wait until the SSH connection is established before continuing, but I needed a way to have tmux wait for the ssh session to be closed (after using send-keys to the remote host in multiple commands) before continuing.
LocalCommand doesn't do this.
here's the question:
After:
1. opening a new tmux session
2. using send-keys to establish an ssh tunnel
3. sending multiple commands to the remote host using send-keys
4. closing the ssh tunnel using send-keys
How can I ensure bash waits until the terminal is ready to receive input before executing the next tmux send-keys command?