Bobo Bobo - 6 months ago 24
Bash Question

Run in parallel from bash

I have this bash script:

for i in `seq 1 10`;
./Hysto file$i.txt

I am completely new to parallel programing and even bash language but i meant by this code to run 10 jobs in parallel (I have more than 10 cores available). The program in meant to save data to some files (which don't depend on each other). However in the folder where the files are supposed to be created they appear one by one (the output of file1.txt, then file2.txt and so on), so I assume they are not run in parallel. Can you tell me how can I write a bash file so I can run my jobs in parallel?


All you need to do to run in parallel in bash is to put an & at the end of your command. Here you'd put it after .txt.

See also: How do you run multiple programs in parallel from a bash script.