3 ms·
> Curl automatically expands glob expressions in URLs into multiple specific URLs. > For example, this command requests three different paths (al, bt, gm), eac
by Karellen 3y ago
> Curl automatically expands glob expressions in URLs into multiple specific URLs.
> For example, this command requests three different paths (al, bt, gm), each with two different parameters (num=1 and num=2), for a total of six URLs:
curl --output-dir /tmp -o "out_#1_#2.txt" http://httpbin/anything/{al,bt,gm}?num=[1-2]
Note that it's not just curl that does glob expansion. So do some shells. Try:
echo http://httpbin/anything/{al,bt,gm}?num=[1-2]
Bash does "brace expansion" on `{al,bt,gm}` to create 3 separate params before they are given to curl/echo. (Although other, stricter bourne shells, like `dash`, do not perform this expansion.)