From 331aa144baf3ddedd28ea28d6c992cba293e78c8 Mon Sep 17 00:00:00 2001 From: Stefan Kreutz Date: Wed, 18 May 2022 22:28:20 +0200 Subject: 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. --- ssh-tmux.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" -- cgit v1.2.3