Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I write a bash script that is going to do the following:

URL = "example.com/imageID="
while (1..100)
   wget URL + $i #it will wget example.com/imageID=1, than 2, than 3 and so on
done

So I have a number of loops to perform, a URL which is ended with a number from the loop. I need to wget all of these.

share|improve this question
up vote 6 down vote accepted

if you are using Bash 4.0, you can do this:

wget example.com/imageId={1..100}.jpg
share|improve this answer

It's fairly easy, even for someone with not much programming experience. When in doubt always read the Bash manual:

for i in {1..100}
do
    wget "example.com/imageID="$i
done
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .