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

```
$ program <input_file>
Running program
1. Option one
2. Option two
select an option: <Expects `1` or `2`>

3. Option three
4. Option four
select an option: <Expects `3` or `4`>

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 < <options>; 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.