LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   bash streams (https://www.linuxquestions.org/questions/linux-desktop-74/bash-streams-647771/)

firewireee 06-08-2008 07:49 AM

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!

Tischbein 06-08-2008 08:23 AM

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.

firewireee 06-09-2008 03:13 AM

OK I'll reform my question.

Is there a program that can record stdin data in a file ?

Tischbein 06-12-2008 06:11 PM

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

firewireee 06-13-2008 01:23 PM

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 ?


All times are GMT -5. The time now is 11:04 AM.