#!/usr/bin/perl -w use strict; use Net::SSH::Perl; my $hostname = "192.168.1.17"; my $username = "root"; my $password = "Pass1234"; my $cmd = 'ls'; my $cmd1 = 'ling -c 2 -q 8.8.8.8'; my $cmd2 = 'ping -w 3 8.8.8.8'; my @cmds = ($cmd , $cmd1, $cmd2); my $ssh = Net::SSH::Perl->new("$hostname", debug=>0); $ssh->login("$username","$password"); foreach my $one(@cmds) { my ($stdout,$stderr,$exit) = $ssh->cmd("$one") ; print $stdout; } #### suse@linux-p9uj:~/junk/vm> ./vmain.pl anaconda-ks.cfg bash: ling: command not found PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq=1 ttl=57 time=125 ms 64 bytes from 8.8.8.8: icmp_seq=2 ttl=57 time=52.1 ms 64 bytes from 8.8.8.8: icmp_seq=3 ttl=57 time=211 ms --- 8.8.8.8 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2003ms rtt min/avg/max/mdev = 52.113/129.706/211.260/65.033 ms