no because first i have to sudo to some other ID and then run commands.....
________________________________ From: David Precious <dav...@preshweb.co.uk> To: Rajeev Prasad <rp.ne...@yahoo.com> Cc: perl list <beginners@perl.org> 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 <rp.ne...@yahoo.com> 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") <dav...@preshweb.co.uk> 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: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/