in reply to safely passing args through ssh
Are there any other ways of solving this problem?
Yes, use Net::OpenSSH!
update (now that I have a real keyboard):
Net::OpenSSH does the quoting for you transparently. For instance...
says 1.$ssh->system('argcount', 'a;b;c');
If arguments are passed as scalar references, an alternative quoting mechanism that lets glob patters pass unquoted is used:
$ssh->system('ls', \'/home/jsmith/*.png');
If you need to run your ssh commands through an intermediate machine, then you can...
Though, probably, you would be able to bypass the intermediate host and get a Net::OpenSSH that runs commands directly on the remote side.$ssh->system('ssh', $host, $ssh->shell_quote($cmd, @args));
|
|---|