0

The following command works as expected:

ssh [email protected] "ssh [email protected] "mysqlshow""

But the following does not:

ssh [email protected] "ssh [email protected] "mysql test -Bse"show variables""" 

The following part works at the command prompt but fails when I do ssh before executing it as shown above.

mysql test -Bse"show variables"

3 Answers 3

4

You can't nest double-quotes like that. You either need to escape them or change your approach.

Try this:

ssh [email protected] "ssh [email protected] \"mysql test -Bse'show variables'\""
2
2

In the command ssh [email protected] "ssh [email protected] "mysql test -Bse"show variables""" you have multiple double quotes. Try escaping them

ssh [email protected] "ssh [email protected] \"mysql test -Bse\\\"show variables\\\"\""
1

Alternatively, you can put

mysql test -Bse"show variables" 

into a script on your server and then just call that script via SSH as you showed in your first example. If you do this, make sure the executable bit is set properly to allow user soak to run it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .