Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

I am working with bash and I am trying to make a curl url call in a for loop.

Below is my simple curl call -

curl -v --header "Connection: keep-alive" "localhost:8080/user?userid=52010&client_id=20&attr=0"

And I am trying to make this curl call in for loop 100 times -

for ((i=1;i<=100;i++)); do   curl -v --header "Connection: keep-alive" "localhost:8080/user?uuid=52010&model_id=20&attr=0" done

I tried running above code as it is in the command line but it doesn't work and it gives me like this -


Any thoughts what wrong I am doing?

share|improve this question

closed as off-topic by devnull, Anthon, Ramesh, Braiam, terdon May 13 '14 at 22:40

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – devnull, Anthon, Ramesh, Braiam, terdon
If this question can be reworded to fit the rules in the help center, please edit the question.

Ah never mind. When the typo is fixed the error went away. That is the reason the question is closed :) Just to let the OP know :) – Ramesh May 13 '14 at 22:13
up vote 8 down vote accepted

You're missing a semicolon after the URL.

You have:

for ((i=1;i<=100;i++)); do   curl -v --header "Connection: keep-alive" "localhost:8080/user?uuid=52010&model_id=20&attr=0" done

It should be:

for ((i=1;i<=100;i++)); do   curl -v --header "Connection: keep-alive" "localhost:8080/user?uuid=52010&model_id=20&attr=0"; done
share|improve this answer
Silly mistake from me. One last question - Is there any way we can sleep between each curl call for few seconds? – lining May 13 '14 at 20:05
Sure. Just put the sleep command before the done and add an extra semicolon. You can add as many commands as you want this way. for ((i=1;i<=100;i++)); do curl -v --header "Connection: keep-alive" "localhost:8080/user?uuid=52010&model_id=20&attr=0"; sleep 3; done – yoonix May 13 '14 at 20:07

Not the answer you're looking for? Browse other questions tagged or ask your own question.