0

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
0

1 Answer 1

1

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
....
....
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.