Reputation: 455
I have a program which accepts inputs through the command line. I want to run the program many times, each time changing the input and I don't want to do it manually. Is there a way to automate that task (maybe through a bash script)?
To make things more tangible:
Suppose the name of the program is "dprog" Is there a way to try different combinations on some of the values below without having to do it by hand each time at the command line?
./dprog 65 100 5120 10 file1.txt file2.txt 10 20 10000
Upvotes: 0
Views: 27
Reputation: 5477
Just write a script that lists all the combinations in the order in which you want to try them... run the script and it will run all of them one after the other. you could probably use a loop of some sort to be even slicker... suggest reading the bash manual...
example:
#!/bin/bash
PROGRAM=./dprog
${PROGRAM} FIRST_GROUP_OF_OPTIONS
${PROGRAM} NEXT_GROUP_OF_OPTIONS
....
....
Upvotes: 1