I have a file which consists of a series of commands, one per line. For example:
Give this a try:
printf "%s\0" "$(cat afile)" | xargs -0 -P 3 -I xxx bash -c xxx
xargs is going to run 3 commands from
afile in parallel.