no because first i have to sudo to some other ID and then run commands.....
________________________________ From: David Precious <[email protected]> To: Rajeev Prasad <[email protected]> Cc: perl list <[email protected]> Sent: Thursday, September 6, 2012 4:57 AM Subject: Re: expect.pm not recognising match string On Wed, 5 Sep 2012 11:27:28 -0700 (PDT) Rajeev Prasad <[email protected]> wrote: > inside ssh tunnel (using Net::Openssh), a pty is opened. > > then an exp object is init to this pty my $exp=Expect->init($pty); > > > using this object i am trying to run about quite a few commands on > remote system. [...] > I would like to send the command and then wait fo rit to finish > (lookout for system prompt) and then execute next command in loop. Is there a reason you can't just let Net::OpenSSH do this for you? From its docs, you can use the capture() / capture2() methods (depending on whether you need to capture just STDOUT or STDOUT and STDERR from the process). For example: for my $command (@commands) { my $result = $ssh->capture($command); } I believe that should work, no? -- David Precious ("bigpresh") <[email protected]> http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedin www.preshweb.co.uk/facebook www.preshweb.co.uk/cpan www.preshweb.co.uk/github -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] http://learn.perl.org/
