LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   To give an input to a running process using shell scripts (https://www.linuxquestions.org/questions/linux-newbie-8/to-give-an-input-to-a-running-process-using-shell-scripts-4175442127/)

rohan511 12-19-2012 05:24 AM

To give an input to a running process using shell scripts
 
I am writing a shell script, to build a program. During the process of building, the build asks the user to give an input(may be a enter or any number). How to give the input automatically(using scripts), wherein the previous process(the build) is still in execution while I need to give the input using scripts.
In the below program the make call need to be written in the scripts.
Ex:
make;
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
Please Press Enter to Continue
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
Press 1 to continue
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
Press 2 to continue

pan64 12-19-2012 05:32 AM

you may create fifos (named pipes) and read it in your program and write it from outside.

chrism01 12-19-2012 07:10 AM

Sounds like you should look at the expect tool http://linux.die.net/man/1/expect


All times are GMT -5. The time now is 12:00 AM.