【发布时间】:2017-12-04 20:25:25
【问题描述】:
我正在运行以下 curl 命令:
installer_to_delete=$(curl -s -u username:password "URL/api/search/dates?dateFields=created&from=${Two_Years_Ago}&today&repos=npm-local-lrn" | jq -r '.results[].uri'|sed 's=/api/storage==')
if [[ $installer_to_delete == "" ]]
then
echo "No installers found"
else
for installer in $installer_to_delete
do
echo $installer
done
fi
这个错误/输出是:
assertion "cb == jq_util_input_next_input_cb" failed: file "/usr/src/ports/jq/jq-1.5-3.x86_64/src/jq-1.5/util.c", line 371, function: jq_util_input_get_position
只要 Curl 命令找不到文件,它就会显示此输出。找不到文件时如何使 JQ 错误不再弹出?
【问题讨论】:
-
这里不需要
sed--jq可以在内部进行字符串替换。