Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: Expecting more from expect

by TilRMan (Friar)
on Jul 08, 2004 at 23:19 UTC ( #372992=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Expecting more from expect
in thread Expecting more from expect

My apologies -- I read the OP too hastily.

Again, will scp do the trick?

You are trying to use the $after_match to grab everything after a match. This is not the way Expect works. It will only read what it needs in order to match the pattern you specified. You need to match the end of the file and then take everything before the end.

#untested my $prompt = "my_unique_custom_prompt_aint_it_neat>"; $object->send("export PS1=$prompt\r"); $object->expect(10, $prompt); $object->send("cat file.txt\r"); $object->expect(10, $header); $object->expect(120, $prompt); my $contents = $object->before();


Comment on Re^3: Expecting more from expect
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://372992]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2015-07-05 07:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls