LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices

Reply
 
Search this Thread
Old 06-08-2008, 07:49 AM   #1
firewireee
LQ Newbie
 
Registered: Jan 2007
Posts: 4

Rep: Reputation: 0
bash streams


I am working with loads of interactive scripts...

I usually run my script like this:

./script_that_runs_for_40_minutes_and_asks_million_questions < answers

It's hard to make answers file without mistakes because there is always someone/something that interupts me...

So is there a way to save all the answer I've typed to a file.

like: ./script < (read the answer and save it to file)

Thanx for your help!
 
Old 06-08-2008, 08:23 AM   #2
Tischbein
Member
 
Registered: Oct 2006
Distribution: debian
Posts: 124

Rep: Reputation: 15
Clarification is needed:
- When running `./script < answers` what does the answers file look like?
- Where do the questions come from?
- Do you have to type anything when running the program? If the answers are in the answers file, why do you need to type anything else? What else do you need to type?
- Regarding the script, do you have access to its source code?

Regards, Entenbein.
 
Old 06-09-2008, 03:13 AM   #3
firewireee
LQ Newbie
 
Registered: Jan 2007
Posts: 4

Original Poster
Rep: Reputation: 0
OK I'll reform my question.

Is there a program that can record stdin data in a file ?
 
Old 06-12-2008, 06:11 PM   #4
Tischbein
Member
 
Registered: Oct 2006
Distribution: debian
Posts: 124

Rep: Reputation: 15
This might be adequate:

Code:
#!/bin/bash

tee tmpout | ssh localhost
(replace ssh localhost with your own command)

In this example the drawback is that ssh checks whether stdin is coming from a terminal, notices that it isn't, and so doesn't print the prompt as usual. You can still run ls, cd etc and see the output, it's just that you won't have a prompt. If your program doesn't try to be smart the above will probably be a tolerable solution.

If that is no good then the nexty best option is to customise your program - doing so should be fairly straightforward. That failing I'd go with customising bash. I'd be happy to help with the last.


Regards, Tischbein
 
Old 06-13-2008, 01:23 PM   #5
firewireee
LQ Newbie
 
Registered: Jan 2007
Posts: 4

Original Poster
Rep: Reputation: 0
Thumbs up Thanx!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Thank you Tischbein !!

That's exactly what I've been looking for!

Is there an index or something of all uncommon linux commands like tee ?
 
  


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
what are streams? kapilcool Linux - Software 1 05-11-2006 10:50 AM
[C++] bytes streams Ossar Programming 1 06-17-2005 02:56 PM
[C++] buffers streams Ossar Programming 1 06-14-2005 12:27 PM
IPC streams. Need help! [C++/bash] krajzega Programming 3 07-18-2004 01:17 PM
tv streams acid_kewpie Linux - Networking 0 09-05-2001 11:17 AM


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