diff options
author | Stefan Kreutz <mail@skreutz.com> | 2022-05-18 22:28:20 +0200 |
---|---|---|
committer | Stefan Kreutz <mail@skreutz.com> | 2022-05-18 22:28:20 +0200 |
commit | 331aa144baf3ddedd28ea28d6c992cba293e78c8 (patch) | |
tree | becab628ced640ad477e4ff9fdc1defdbbf9bc86 | |
parent | f02ee43b9e2d9fcc5c02eb82082b0ee49f915512 (diff) | |
download | ssh-tmux-331aa144baf3ddedd28ea28d6c992cba293e78c8.tar |
Replace final exec shell with read
The exec shell trick to seemingly continue the exited shell may confuse
the user because it doesn't preserve the environment, only the working
directory. The read accomplishes the same goal, to preserve the remote
command's output, without tricking the user.
-rwxr-xr-x | ssh-tmux.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ssh-tmux.sh b/ssh-tmux.sh index 2568e24..e1ef53e 100755 --- a/ssh-tmux.sh +++ b/ssh-tmux.sh @@ -43,6 +43,6 @@ if [ $# -eq 0 ]; then err_exit "missing command argument" fi -cmd="\"\$SHELL\" -ilc '( $* ) || print -u2 -- \"[exited with status \$?]\" ; exec \"\$SHELL\"'" +cmd="\"\$SHELL\" -ilc '( $* ) || print -u2 -- \"[Exited with status \$?]\" ; printf \"[Press Enter to exit]\" ; read -r'" exec ssh -t "$host" -- tmux new-session ${detach:+-d} ${session:+-s \"$session\"} ${window:+-n \"$window\"} "$cmd" |