我有一个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.
一切都有帮助 谢谢。
答案 0 :(得分:13)
试试这个:
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