diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2022-06-21 11:47:07 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2022-06-21 17:23:18 -0700 |
commit | 6ee710e12d13ef8874a4b7b7a2529c0ee7de827c (patch) | |
tree | e60cfb234be7180a38d85d8b96078e3a5fc6983a /bin/ssh-and-tmux | |
parent | 404afc1f834054bb6a2d8687558d3de804504aed (diff) | |
download | dotfiles-6ee710e12d13ef8874a4b7b7a2529c0ee7de827c.tar.gz |
ssh-and-tmux: on successful ssh exit, exit script
Diffstat (limited to 'bin/ssh-and-tmux')
-rwxr-xr-x | bin/ssh-and-tmux | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/bin/ssh-and-tmux b/bin/ssh-and-tmux index 1aca3efc..cd66ecc2 100755 --- a/bin/ssh-and-tmux +++ b/bin/ssh-and-tmux @@ -72,12 +72,18 @@ fi if $use_mosh; then mosh "$host" -- "${cmd[@]}" else + # The idea behind quitting on d, C-c or C-d was so that the user can type + # C-d C-d to kill the remote shell and then kill this script, C-\ d d to + # detach tmux and then kill this script, or similar. + # + # We now die when ssh exits zero, so this feature may be obsolete. + echo -ne "\033]0;tmux $session on $display_host\007" prompt="Press any key to reconnect to tmux session [1m$session[0m on " prompt+="[1m$display_host[0m; d/C-d/C-c to give up .." while true; do - ssh -t "$host" "${cmd[*]}" + ssh -t "$host" "${cmd[*]}" && exit clear read -n 1 -r -s -p "$prompt" ch [ "$ch" = $'\04' -o "$ch" = d ] && echo && exit |