Home > Net >  How to run multiple instances of the same program with different parameters on threads using shell c
How to run multiple instances of the same program with different parameters on threads using shell c

Time:01-06

for testing purpose I have to run my C program with different parameters and files passed as arguments.

I created a test.sh file that runs each test one by one, but it takes a very long time because the program is a bit heavy.

I would like to find a way to run each test on a dedicated thread.

exemple of sh line of test:

./program inputFile1 outputFile1
./program inputFile2 outputFile2
./program inputFile3 outputFile3
./program inputFile4 outputFile4

CodePudding user response:

You can run it in background, like

./program inputFile1 outputFile1 &
./program inputFile2 outputFile2 &
./program inputFile3 outputFile3 &
./program inputFile4 outputFile4 &

Read more about it here: https://www.linuxtechi.com/run-linux-shell-command-in-background/

To summarize: your code will just initiate these jobs and move on while running the others.

  • Related