我有一个脚本按数字下载JSON文件并将它们保存在一个文件夹中 . 问题是某些文件不存在 .

我希望脚本忽略所有不是200的HTTP响应,并且不会保存文件 .

有任何想法吗?

#!/bin/bash
for i in $(seq 1 70);

do 
curl -k --header "Authorization: XXX" --header "Accept: application/xml" --header "Content-Type: application/json" https://test.local/files/${i}.json -o ${i}.json;

done