sh -c 'echo hello ; echo world'
Works fine on both host and remote machine, with the output of:
hello
world
but when I do
ssh username@remote sh -c 'echo hello ; echo world', then the output is:
world
Why did the command eat my first echo hello command?
sh -c echo hello; echo world,sh -c echo hellorunsechowithout arguments (hellois$0forsh -c), andecho world, so you get the empty line andworld. – muru Mar 14 '21 at 18:36