2

I have a script called step1.sh, and I pass one input parameter to the script ($1). I can run the script like this if I want the input to be 300.1

./step1.sh 300.1

I want to run this script 200 times, with 200 different inputs (they are random numbers, not a logical list of numbers). And I only want 4 scripts to run in parallel at a time.

Can someone help me write a command I can run in Ubuntu terminal to achieve this?

I am thinking I can create a .txt-file, input_parameters.txt, with the 200 different inputs.

300.1
290.12
250.2
250
174
250.1

And then something like:

cat input_parameters.txt | parallel -j 4 sh step1.sh

I am not well experienced with GNU parallel and struggle to find out which options to use. Can someone help me write a command?

1 Answer 1

1

Yep this should work:

cat input_parameters.txt | parallel -j 4 sh step1.sh

Consider spending 20 minutes on reading chapter 1+2 https://doi.org/10.5281/zenodo.1146014 Your command line will love you for it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .