Thursday, 25 October 2018

bash - Script selection of options inside running program

I want to run a program that expects two inputs after executing to decide how it will run. Like so:


$ program 
Running program
1. Option one
2. Option two
select an option:

3. Option three
4. Option four
select an option:

Running with selected options.

I would like to run it for many input files for which the same options will be selected. Right now I do:


$ for i in *; do program $i; done

With this I have to select the options manually for every file. How can I pass the options to the program to automate it? Something like:


$ for i in *; do program $i < ; done

The program repeats the available options if the correct one is not selected. So when I tried with {echo 2; echo 4} and echo "2\n4\n" it gets stuck on the first option selection.

No comments:

Post a Comment

Where does Skype save my contact&#39;s avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...