title: Multiple curl in parallel with limitations
body: <p>I have a json file, with entries containing urls (among other things), which i retrieve using curl.
  I'd like to be able to run the loop several times at once to go faster, but also to have a limitation of the number of parallel curls, to avoid being kicked out by the distant server.
  For now, my code is like </p>
  
  <pre><code>  jq -r '.entries[] | select(.enabled != false) | .id,.unitUrl' $fileIndexFeed | \
    while read unitId; do
      read -r unitUrl
      if ! in_array tabAnnoncesExistantesIds $unitId; then
        fullUnitUrl="$unitUrlBase$unitUrl"
        unitFile="$unitFileBase$unitId.json"
        if [ ! -f $unitFile ]; then
          curl -H "Authorization:$authMethod $encodedHeader" -X GET $fullUnitUrl -o $unitFile
        fi
      fi
     done
  </code></pre>
  
  <p>If i use a simple &amp; at the end of my curl, it will run lots of concurrent requests, and i could be kicked.
  So, the question would be (i suppose) : how to know that a curl runned with an &amp; has finished its job ? If i'm able to detect that, then i guess that i can test, increment and decrement a variable telling the number of running curls.</p>
  
  <p>Thanks</p>