Search code examples
shellcurldelay

Shell - delay between cURL requests


I have a shell script for cURL requests and I would like to add delay after each request. I've seen some solutions here but none of them really suited my needs.

One way to do it with desirable output was this way:

curl 1
sleep 10
curl 2
sleep 10
curl 3
...

But pasting sleep between commands for a list of 2000+ urls isn't really the way to go.

There must be a more elegant solution. Would there be anybody willing to share it with me?

Thank you!


Solution

  • Why not create a function, which you can reuse:

    curlme (){
    curl $1
    sleep 10
    }
    
    #and use as:
    curlme url1
    curlme url2
    ...