![]() |
what is this called
I script with ksh.
I run a script and this calls a couple of programs, these programs then request input for example: Would you like to back up the table structure also (y/n)? I’m not sure what language they are in. What is it referred to in programming when I want to put input into these requests with a script rather then having to do it manually? If I can find out this then I got a chance at googling it. Thanks hush |
Not quite sure what you're asking. Most console scripts get input from the user via STDIN, and report back via STDOUT. You can pipe the STDOUT from one program to the STDIN of another by using pipes.
For example, the command "yes" outputs a continual stream of identical lines. By default, it's "y". Thus, by piping "yes" to a different program, you can get it to answer "y" to every question posed: :
yes | some_program:
some_file > some_program |
Thanks for the reply arevos.
Sorry I could not be clearer in my explanation. I’m aware of pipes. What about if the program requests multiple standard inputs? Could I use a file? How would it be structured e.g would I use \n to move onto the next standard input? I would have tried this but the unix box I use at work is a production system. Is there another way to supply standard input; if so what is it called ? (this is the issue I was attempting to ask a question on in my first post) hush |
Your question isn't clear. There are multiple ways to input data into a program; via a GUI interface, via a TCP socket, via a file - the list goes on. The standard way of inputting data to console applications is STDIN, which most non-GUI console applications use. If you want to mix user input with automated input via STDIN in a custom arrangement, you'll probably need a more powerful scripting language than KSH. Possibly something like Perl or Python.
|
i found this:
http://en.wikipedia.org/wiki/Expect what i was asking is not possible without a tool like this. cheers anyway. hush |
Do you know about the here document?
:
/path/to/myprogram $USER $PASS<<EOFThis is essentially what expect does. It knows the questions and answers ahead of time. |
no, i will look into that cheers.
|
| All times are GMT -5. The time now is 1:36 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC