Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 05-19-2010, 04:34 AM   #1
LQ Newbie
Registered: Oct 2007
Posts: 3

Rep: Reputation: 0
shell script for a partial control over inputs to an external program

Hi all,

I've a software written by a third party (for linux distros, Ubuntu to be precise). This program executes while asking for user input (via stdin) at various stages of its running.
Now, a few of these stages/steps can be automated because the user input required is always the same. The other stages have varying inputs that depend on the outcome of some measurements from the previous stages; and so, have to be entered on-the-fly.
To elaborate, one can roughly describe the running of the program in this fashion:

Step0 - User input fixed
Step1 - User input fixed
Step2 - User input variable

Step3 - User input fixed
Step4 - User input fixed
Step5 - User input fixed
Step6 - User input fixed (and one can choose here either to return to Step3 or proceed to Step7)

Step7 - User input fixed
Step8 - User input variable
Step9 - User input variable


So, I wish to automate the Run portion from Step3 to Step6 now... the picture I've in my mind is of a shell script which runs in the background, parsing the stdout of the program (mainly textual in nature) and lets the program start in the usual way for the Init steps i.e. waits for the user to enter the input via stdin for Step0 to Step2.
From then on, it runs for say 5000 times, but now picking the input parameters from a file instead (created accordingly, to run Step3 to Step6 in a loop for 5000 times) and then at the 5001st instant, chooses to proceed to Step7.

I had had some exposure to linux shell programming quite long ago, but that seems enough to convince me that coding the above shouldn't be very hard ;-) but I look forward to your tips, pointers and suggestions on how to do it in the best possible way.

Thanks very much in advance,
Old 05-19-2010, 07:57 PM   #2
Senior Member
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Stretch/Sid, Linux Mint DE
Posts: 4,634

Rep: Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713
There is only one programming language I that can do this, expect. Of course it is a far cry from Bash, and you must spend two evenings going thru a Tcl tutorial, but it works very reliable.



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
running a shell script which invokes another shell program!!! raghu123 Programming 1 08-04-2008 09:10 AM
shell script inputs aloishis89 Programming 3 03-10-2008 02:23 AM
Apache2 refuses control inputs IMS_Scott Linux - Server 3 11-28-2006 06:32 AM
! HELP ! Script : How to control parent shell ??? fawqati Programming 1 06-03-2006 12:58 PM
Shell Script to control logins NIkss Programming 9 12-17-2003 12:53 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:26 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration