LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 06-21-2007, 10:44 AM   #1
johnpaulodonnell
Member
 
Registered: Jun 2006
Location: Galway
Distribution: Suse 10.1
Posts: 114

Rep: Reputation: 15
How to write output from expect to a file?


Hi.

Very new to expect! Only know the very basic commands...

I can use spawn to start a process, expect to anticipate the program prompt and send to send input to the program...

so schematically I have:

Code:
#!/usr/bin/expect

spawn program
expect "prompt"
send "response"
expect "next prompt"
send etc etc
...
...
expect "final prompt"
send "response to get final answer!"

What now to write this result to a temp.file??
Is there someform of > that I can use?

Thanks - all tutorials online seem to be based around ftping
 
Old 06-21-2007, 11:50 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
you can just enable a log file on demand, fairly simple using the log_file directive as seen in the manpage.
 
Old 06-22-2007, 05:07 AM   #3
johnpaulodonnell
Member
 
Registered: Jun 2006
Location: Galway
Distribution: Suse 10.1
Posts: 114

Original Poster
Rep: Reputation: 15
thanks Chris.
 
  


Reply


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 - read passphrase from a file hk_linux Programming 2 03-01-2018 02:34 AM
Expect script - No output to file pandersson61 Programming 4 05-23-2007 05:18 AM
Dvd:rip / transcode users: when you rip dvds, is the output file the size you expect? 144419855310001 Linux - Software 0 09-02-2006 08:56 AM
the sound gives output when using mic but no output when run a music file medo Debian 0 04-19-2004 07:17 PM
File Manager SU mode using expect Allen614 Programming 0 02-26-2003 01:29 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:25 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration