LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   PERL expect o/p (http://www.linuxquestions.org/questions/programming-9/perl-expect-o-p-871065/)

AlbertJJ 03-25-2011 11:35 PM

PERL expect o/p
 
Hello geeks,

Could you please tell me how to get output of last command executed through expect(in PERL) so that i could analyse and process it for the next steps? What if the last command output if long?(multiline and multicolumn). Is it possible to redirect the o/p to a file and then process it?

Thanks.

Sergei Steshenko 03-26-2011 02:07 PM

Quote:

Originally Posted by AlbertJJ (Post 4303780)
Hello geeks,

Could you please tell me how to get output of last command executed through expect(in PERL) so that i could analyse and process it for the next steps? What if the last command output if long?(multiline and multicolumn). Is it possible to redirect the o/p to a file and then process it?

Thanks.

I am not sure I understand what the real problems are, but how about

http://search.cpan.org/~rgiersig/Expect-1.21/Expect.pod

?

AlbertJJ 04-08-2011 05:26 PM

I already went thru' Expect pod but its not that helpful, not at all in some cases.
Can anyone who has good experience or who know the answer to the question reply please?????

Sergei Steshenko 04-08-2011 10:11 PM

Quote:

Originally Posted by AlbertJJ (Post 4318531)
I already went thru' Expect pod but its not that helpful, not at all in some cases.
Can anyone who has good experience or who know the answer to the question reply please?????

What exactly is unclear in http://search.cpan.org/~rgiersig/Expect-1.21/Expect.pod ?

AlbertJJ 07-29-2011 03:15 AM

Ok. The Problem is:

I want to get the warning messages when a command is executed and take action based on the warning messages.

prompt>delete fs
WARNING: Are you sure(Y/N).. backup is running.

In the above scenario I need to get the WARNING message as input before proceeding and then send a 'Y'.
The waning may not be displayed as shown below:
In some cases if backup is not running:

prompt>delete fs
Done...


All times are GMT -5. The time now is 10:39 PM.