I have a C program that I compile to make an executable file. I want to make a script that starts the C program, runs several commands that the script contains and eventually exits the script. The C program requires its inputs (commands) as user specified arguments.
I tried scripting something like this:
#/bin/bash
./program
command 1
command 2
..
quit # A quit command within the program
But the program does not seem to understand that after I start the execution that the following commands should be arguments to the C program.
I tried to check the commands of my program, but maybe a separate C program that checks this would be better. How would you suggest that it be debugged?