http://www.perlmonks.org?node_id=1023640


in reply to Re^2: Urgent Help For Perl Issues
in thread Urgent Help For Perl Issues

Just use the cd command with your path and navigate to your path and do untar

my($stdout, $stderr, $exit) = $ssh->cmd("cd $path"); ($stdout, $stderr, $exit) = $ssh->cmd("untar tar.gz");

Replies are listed 'Best First'.
Re^4: Urgent Help For Perl Issues
by Anonymous Monk on Mar 15, 2013 at 09:31 UTC
    Hi Vinoth,
    my $ssh = Net::SSH::Perl->new($host); $ssh->login($user, $password); my($stdout, $stderr, $exit) = $ssh->cmd("cd testing"); ($stdout, $stderr, $exit) = $ssh->cmd("unzip wwww.zip");
    This one i used. But file unzipped in home directory only not unzipped inside testing folder.. Any Worng....

      As suggested by marto just print

      print "$stdout\n"; print "$stderr\n"; print "$exit\n";

      after

      my($stdout, $stderr, $exit) = $ssh->cmd("cd testing");
        ssh opens a new session for every command run and so commands with side effects as cd doesn't work as expected.

        Use shell conjunctions instead to run the two commands as one:

        $ssh->cmd("cd $dir && $cmd")
        Showing Empty Values Only Marto..No Luck