Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

364
Views
Download multiple files simultaneously with variable in URL with Curl

So I have a little bash script:

for store in {4..80}
do
  for page in {1..200} 
  do
    curl 'https://website.com/shop.php?store_id='$store'&page='$page'&PHPSESSID=sessionID' -O
  done
done

The script is working but downloads all 200 store pages of all stores from 4-80 one after another, which takes a lot of time. (Notice the bash variable store and page in the curl URL)

My goal would be to run as many curl requests simultaneously for each store/page instead getting it worked on one after one, to save time.

Is this possible?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

curl can run loops itself. This limits curl to 100 simultaneously sessions:

curl 'https://website.com/shop.php?store_id=[4-80]&page=[1-200]&PHPSESSID=sessionID' -O --parallel --parallel-max 100
over 4 years ago · Santiago Trujillo Report

0

Try changing you script as follow:

for store in {4..80}; do
  for page in {1..200}; do
    curl 'https://website.com/shop.php?store_id='$store'&page='$page'&PHPSESSID=sessionID' -O &
  done
done

# Wait for spawned cURLs...
wait
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!