Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
    
Hint: apropos sleep; man 1 sleep –  alex Feb 7 '11 at 19:34

1 Answer 1

up vote 10 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.