ssh "bash -c" bug

Peter Stuge peter at stuge.se
Fri Feb 22 01:05:12 EST 2013


Phil Pennock wrote:
> > > Instead of confusing shell quoting I recommend piping the commands
> > 
> > ..must..avoid..learning..
> 
> The OP's shell quoting was absolutely correct,

The quoting was obviously NOT correct because things didn't work as
intended. The incorrect quoting demonstrated a lack of understanding
for the tools being used. That's an unneccessary waste of time.


> for pretty much any command wrapper

ssh is a shell, not a command wrapper. Please just learn how your
shell's quoting works and reap the benefits of that instead of
resisting something because it doesn't fit into a certain pattern.


101 exercise:

sh -c echo $$; echo $$
sh -c 'echo $$; echo $$'

201 exercise:

sh -c sh -c echo $$; echo $$
sh -c sh -c 'echo $$; echo $$'

301 exercise:

sh -c "sh -c echo $$; echo $$"
sh -c "sh -c 'echo $$; echo $$'"


Compare the exercises with using "ssh somehost" instead of "sh -c".


//Peter


More information about the openssh-unix-dev mailing list