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

How can I add a 10sec sleep to my loop after each page is processed?

#!/bin/sh

for page in {1..50}
do
    wget -q -U Mozilla "http://admin.domain.com/products_search/?p=$page" -O - \
    | tr '"' '\n' | grep "^Product photo for " | cut -d ' ' -f 3 > bproduct.txt
done
share|improve this question
1  
Hint: apropos sleep; man 1 sleep – alex Feb 7 '11 at 19:34
up vote 14 down vote accepted
#!/bin/sh

for page in {1..50}
do
    wget -q -U Mozilla "http://admin.domain.com/products_search/?p=$page" -O - \
    | tr '"' '\n' | grep "^Product photo for " | cut -d ' ' -f 3 > bproduct.txt
    sleep 10
done

Should work

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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