I am copying and pasting sequences of shell commands into my terminal emulator, and I am confused by the behaviour.
- When I paste the single line
ssh user@remote "echo foo"; echo bazthe computer does what I expect. It runs the SSH command and then echoes something after I have finished my SSH session.
- When I paste the same thing as a multiple-line command, however, this does not happen.
ssh user@remote "echo foo" echo bazI still get the SSH session, but the
echo bazcompletely disappears. No command is run.
- This seems to be something to do with SSH, at least. Because replacing SSH with something else yields the behaviour that I was actually expecting.
Both commands run when I paste this, for example:
echo foo echo baz
So what is happening? Where is the pasted input going? Why is the echo command not executed by anything? How is this related to SSH?
(By the way: I know of Ctrl+X, Ctrl+E method, but sometimes, especially when using terminal emulators on Windows, this won't work out of the box.)