I'm writing a procedure in bash which copies files around a number of servers. As a basic check I'm running
So far all well and good.
However some of the servers are only reachable via a double jump. i.e. to run a comand you have to run
For simple commands this works fine. However, as soon as I try passing complex commands like the one above I get all sorts of problems with the quoting. The simple
drops the single quotes on remote1 and runs the cd on remote2 but the ls on remote1. I've tried things along the lines of escaping the quotes, quoting the escaped quotes, etc. but nothing is working.
My last resort is to encapsulate the commands and distribute them as executable files but...
Any help much appreciated.
On the internet no one knows you're a dog
Columb Healy
Code:
ssh remote_host 'cd /remote/dir;ls | wc -l'
However some of the servers are only reachable via a double jump. i.e. to run a comand you have to run
Code:
ssh remote1 ssh remote2 command
Code:
ssh remote1 ssh remote2 'cd /remote/dir;ls | wc -l'
My last resort is to encapsulate the commands and distribute them as executable files but...
Any help much appreciated.
On the internet no one knows you're a dog
Columb Healy