How to loop multithread wget in Linux command line?

apple guava

New member
Wget itself is not multithread but I can issue them serially linked up by & and with -N parameter to skip already existing files eg:

wget -r -N http://www.example.com &
wget -r -N http://www.example.com &
wget -r -N http://www.example.com

This should start up 3 simultaneous processes that are complementary to each other.

Suppose I want to issue 10 processes. Rather than doing the above ten times (link up ten wget with nine &), what's a neater way of issuing the command in command line with variable i where i is the number of simultaneous processes?

I tried for and do but that didn't work. What happened was one wget would start and then finish, and then next wget starts and then finish so on.

So my question is, how do I issue one line of command in Linux shell to achieve this effect:

wget -r -N http://www.example.com &
wget -r -N http://www.example.com &
.
.
.
wget -r -N http://www.example.com


Where the parameter i in the one line command specifies how many repeats.

Thanks.
 
Back
Top