Run the same command multiple times in background

The &, just like ; is a list terminator operator. They have the same syntax and can be used interchangeably (depending on what you want to do). This means that you don't want, or need, command1 &; command2, all you need is command1 & command2.

So, in your example, you could just write:

for i in {1..10}; do wait file$i & done

and each wait command will be launched in the background and the loop will immediately move on to the next.


For the sake of compatibility use the posix form instead of expansion:

for i in $(seq 1 10); do (./wait file$i &); done

You can group the commands and put the grouped commands in background. Like :

$ for i in {1..10}; do ((wait file$i)&); done