linux - How to run curl command with parameter in a loop from bash script? -


this question has answer here:

i have curl command execute in loop. example wanted loop 1-100 times , when curl command runs uses iterator variable value in curl command itself.

#!/bin/bash   in {1..10}      curl -s -k 'get' -h 'header info' -b 'stuff' 'http://example.com/id=$i'          done  --notice here want var changing every curl. 

anything helps thanks.

try this:

set -b                  # enable brace expansion in {1..10};   curl -s -k 'get' -h 'header info' -b 'stuff' 'http://example.com/id='$i done 

see: difference between single , double quotes in bash


Comments