in reply to Re^3: Send password in Net::SSH::Expect
in thread Send password in Net::SSH::Expect
I would first construct the complete command and use the same string for debugging and for running the command:
my $cmd = "ssh -qv $ssh_user\@$bkp_destination 'sed -i \"s#.*$hostname +#$skey#g\" /tmp/test.txt'"; warn "Launching [[$cmd]]"; system($cmd) == 0 or die "Couldn't launch ssh connection via [[$cmd]]: $? / $!";
That way, the command you use for debugging and the command you run cannot deviate.
Maybe using the # char (shell comment indicator) somewhere messes up your shell quoting. Even for readability, I would construct the shell string differently:
my $cmd = qq(ssh -qv $ssh_user\@$bkp_destination 'sed -i "s#.*$hostnam +e#$skey#g" /tmp/test.txt');
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Send password in Net::SSH::Expect
by gafaman (Novice) on Jan 23, 2020 at 09:24 UTC | |
by Corion (Patriarch) on Jan 23, 2020 at 09:36 UTC | |
by gafaman (Novice) on Jan 23, 2020 at 09:58 UTC | |
by Corion (Patriarch) on Jan 23, 2020 at 10:28 UTC | |
by gafaman (Novice) on Jan 23, 2020 at 10:42 UTC | |
|