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 baz
the 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 baz
I still get the SSH session, but theecho baz
completely 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.)
ssh
as the source of this behavior? It might be one of the cases, and since I didn't search for any other, I've decided to leave it as an example. Or do you refer to "copy-pasting" instead of "evaluating pasted"?