Parallelizing a for loop
The original code might look like this:
for i in *; do something.py $i; done
I was wondering whether I can run these jobs parallelly in the backgroud, such as:
for i in *; do something.py $i &; done
I tried and found the
& here won't work..
Moreover, a better way might be that bash allow 8 jobs(or any number) run together in the queue in background, but I don't know how to do that...
Does anyone have ideas about this? Thanks!