Doo*_*ana 5 linux bash scripting curl
我有一个curl命令,我想在for循环中执行.例如,我想循环1-100次,当curl命令运行时,它在curl命令本身中使用iterator变量值.就像是
#!/bin/bash
for i in {1..10}
do
curl -s -k 'GET' -H 'header info' -b 'stuff' 'http://example.com/id=$i'
done
--notice here I want var i to be changing with every curl.
Run Code Online (Sandbox Code Playgroud)
什么都有帮助谢谢.
Cyr*_*rus 17
试试这个:
set -B # enable brace expansion
for i in {1..10}; do
curl -s -k 'GET' -H 'header info' -b 'stuff' 'http://example.com/id='$i
done
Run Code Online (Sandbox Code Playgroud)