LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 04-11-2007, 06:28 PM   #1
Akhran
Member
 
Registered: Aug 2005
Distribution: Debian 'lenny'
Posts: 208

Rep: Reputation: 30
Is it possible to capture the output of a interactive script?


I have an interactive script that prompt a few questions while it is installing an application. Is there a way to capture or log down the standard output into a file and still get to see the questions that are prompted by the script?

# ./some_script > captured_test

does not work as I do not get to see the questions that the script prompted.

Thanks !
 
Old 04-11-2007, 06:39 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,123

Rep: Reputation: 151Reputation: 151
Have you tried the tee command? The man page gives more info, but basically, you'd use:
Code:
./some_script | tee captured_test
Admittedly, I haven't tried this on an interactive script...
 
Old 04-11-2007, 06:52 PM   #3
Akhran
Member
 
Registered: Aug 2005
Distribution: Debian 'lenny'
Posts: 208

Original Poster
Rep: Reputation: 30
Tried that, but you also don't get to see the questions prompted while the script is running.

Thanks.

Quote:
Originally Posted by gilead
Have you tried the tee command? The man page gives more info, but basically, you'd use:
Code:
./some_script | tee captured_test
Admittedly, I haven't tried this on an interactive script...
 
Old 04-11-2007, 08:06 PM   #4
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,123

Rep: Reputation: 151Reputation: 151
The only other thing I could suggest is to try using tail on the device that drives whatever console you are running the script in.

For example, if you're running the script on console 1, you would have sudo tail /dev/vcs1 running on console 2.
 
Old 04-11-2007, 09:28 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,269

Rep: Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028
tee should work - I have done such. Worked fine.
Only had to use the second session when I did as per the first post.
 
  


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
shell script read non-interactive comtmr Linux - General 6 11-01-2006 06:54 AM
Capture output from another computer mijohnst Linux - General 2 09-21-2006 03:58 PM
capture the output to a variable Melsync Linux - General 4 09-07-2006 02:17 PM
Bash script- capture cdparanoia text output code-breaker Linux - Software 7 08-03-2006 10:13 PM
Please help with interactive script moosedaddy Linux - Newbie 3 12-08-2005 09:02 PM


All times are GMT -5. The time now is 12:46 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