我有一个包含3000个唯一ID的列表。
我想运行多个CURL命令,如下所示:
$ curl -i -u user:password -X DELETE https://mywebsite.com/rest/v2/page/[UniqueID]/
$ curl -i -u user:password -X DELETE https://mywebsite.com/rest/v2/page/[UniqueID]/
$ curl -i -u user:password -X DELETE https://mywebsite.com/rest/v2/page/[UniqueID]/
等
有没有办法非手动执行此操作,以便我不会在每个唯一ID中复制/粘贴并按下我的mac终端上的返回3000次?
答案 0 :(得分:1)
您可以使用bash大括号扩展 http://wiki.bash-hackers.org/syntax/expansion/brace
例如id 1,2,3,4
curl -i -u user:password -X DELETE https://mywebsite.com/rest/v2/page/{1,2,3,4}/
或id 1到100
curl -i -u user:password -X DELETE https://mywebsite.com/rest/v2/page/{1..100}/