Re: [Ssh-sftp-perl-users] want to get rid of IO::Socket::INET messages.
Brought to you by:
dbrobins
From: Matthew J. S. <vag...@ya...> - 2006-04-20 13:24:20
|
--- Ajit <aji...@re...> wrote: > Hi Guys, > I have written a small perl script > > #!/usr/bin/perl > use strict; > use Net::SSH::w32Perl; > use Net::SSH::Perl; > > my $user = "root"; > my $pass = "password"; > my $host = "192.168.0.123"; > my $cmd = "ls -lt"; > my $ssh = Net::SSH::W32Perl->new($host); > > $ssh->login($user, $pass); > my @test = $ssh->cmd($cmd); > print @test; > > > The script when executed gives desired output , > but it gives some additional messages before giving > proper output > these messages are as follows , > > IO::Socket::INET at > C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295 > IO::Socket::INET at > C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295 > IO::Socket::INET at > C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295 > IO::Socket::INET at > C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295 > IO::String at > C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110 > IO::Socket::INET at > C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295 > IO::String at > C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110 > IO::Socket::INET at > C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295 > IO::String at > C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110 > IO::String at > C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 118 > IO::Socket::INET at > C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295 > IO::String at > C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110 > IO::Socket::INET at > C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295 > total 9250 > dr-xr-xr-x 52 root root 63168 Apr 20 > 15:56 proc > drwxrwxrwt 4 root sys 249 Apr 20 > 15:55 tmp > drwxr-xr-x 17 root sys 4096 Apr 20 > 11:00 dev > -rw-r--r-- 1 root root 13770 Apr 20 > 11:00 buildsanity > dr-xr-xr-x 6 root root 512 Apr 13 > 14:05 vol > drwxr-xr-x 75 root sys 4096 Apr 13 > 14:05 etc > dr-xr-xr-x 1 root root 1 Apr 13 > 14:05 home > dr-xr-xr-x 1 root root 1 Apr 13 > 14:05 net > drwxr-xr-x 2 root sys 512 Apr 13 > 14:03 devices > drwxr-xr-x 2 root root 512 Apr 5 > 15:43 Documents > drwxr-xr-x 40 root sys 1024 Mar 30 > 11:24 usr > drwxr-xr-x 8 14478 staff 512 Mar 23 > 16:20 opt > drwxr-xr-x 6 root root 512 Mar 21 > 16:55 cdrom > -rw-r--r-- 1 root root 26 Mar 20 > 14:52 sdm > drwxr-xr-x 2 root root 512 Mar 20 > 14:11 Desktop > -rw-rw-r-- 1 root gsm 68624 Mar 3 > 19:44 Message.log > drwxr-xr-x 11 root sys 512 Mar 2 > 15:27 mnt > -rwxr-xr-x 1 root root 607744 Feb 23 > 13:27 ssh.tar > -rwxr-xr-x 1 root root 93184 Feb 23 > 12:45 tar.sh > drwxr-xr-x 2 root root 512 Feb 23 > 11:16 TT_DB > drwxr-xr-x 41 root sys 1024 Feb 23 > 11:12 var > drwxr-xr-x 7 root bin 5120 Feb 23 > 10:53 lib > drwxr-xr-x 14 root sys 512 Feb 22 > 19:12 kernel > drwxr-xr-x 2 root sys 1024 Feb 22 > 19:06 sbin > drwxr-xr-x 33 root sys 1024 Feb 22 > 18:38 platform > drwxr-xr-x 4 root root 512 Feb 22 > 18:38 system > lrwxrwxrwx 1 root root 9 Feb 22 > 18:38 bin -> ./usr/bin > drwxr-xr-x 3 root sys 512 Feb 22 > 18:37 export > drwx--x--x 2 root root 8192 Feb 22 > 18:37 lost+found > 0 > > How can i overcome these additional messages and > "0" after my desired output. > > Thanks > ~ajit > The 0 that gets printed at the end is the exit code of the command you are executing. Change: my @test = $ssh->cmd($cmd); print @test; To: my($stdout, $stderr, $exit) = $ssh->cmd($cmd); print $stdout; What version of Net::SSH::Perl are you using? __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |