Code:
#!/usr/bin/perl
$acc = "root";
$ips=$ARGV[0]; ## this holds the command needs to run on remote host.
@ipary= split(/\,/,$ips); ## split if there are more then one host
for $ipary(@ipary){
print ("\n");
print "connecting ......$ipary \n";
system("ssh root\@$ipary $ARGV[1]"); ## execute ssh command
}
Problem here is if I do
Code:
./program.pl 10.10.10.10 "pwd && ls "
It execute pwd on remote host BUT it execute ls on local host.
I have done same with shell script in a different environment(some where else) and it worked
AND
Now
I have used normal shell
as
Code:
ssh root@10.10.10.10 "pwd && ls"
Above command execute both command on remote host.
Thanks