LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 03-25-2011, 11:35 PM   #1
AlbertJJ
LQ Newbie
 
Registered: Oct 2010
Posts: 12

Rep: Reputation: 0
Exclamation 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.
 
Old 03-26-2011, 02:07 PM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 452Reputation: 452Reputation: 452Reputation: 452Reputation: 452
Quote:
Originally Posted by AlbertJJ View Post
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

?
 
Old 04-08-2011, 05:26 PM   #3
AlbertJJ
LQ Newbie
 
Registered: Oct 2010
Posts: 12

Original Poster
Rep: Reputation: 0
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?????
 
Old 04-08-2011, 10:11 PM   #4
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 452Reputation: 452Reputation: 452Reputation: 452Reputation: 452
Quote:
Originally Posted by AlbertJJ View Post
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 ?
 
0 members found this post helpful.
Old 07-29-2011, 03:15 AM   #5
AlbertJJ
LQ Newbie
 
Registered: Oct 2010
Posts: 12

Original Poster
Rep: Reputation: 0
Smile

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...
 
  


Reply

Tags
automation, expect, perl


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Expect script: how do i send function key F12 in an expect script alix123 Programming 4 09-01-2013 09:06 PM
[SOLVED] /usr/bin/expect : Script to check server load using both expect and bash Soji Antony Programming 1 07-27-2010 11:27 PM
expect: line seems to match exactly, however expect thinks not deadeyes Linux - General 5 06-16-2010 06:05 PM
LXer: Basics 101: ruby python bash perl expect php, How do the exact same thing in th LXer Syndicated Linux News 0 10-05-2008 06:00 AM
[Perl] Expect.pm local passwd change noir911 Programming 3 02-16-2007 07:30 AM


All times are GMT -5. The time now is 07:42 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration