我有一个测试脚本与各种输入一遍又一遍运行一个小应用程序再次:防止庆典
# test_script.sh
for input1 in $some_range; do
for input2 in $some_other_range; do
if ! ./my_app $input1 $input2 2>/dev/null; then
echo "ERROR: app failed with inputs: $input1 $input2"
fi
done
done
这是一切都很好,当它失败时,除了我得到两个消息,在“错误”的消息我想要的,然后又是(显然是从庆典?)提醒我,我的应用程序被中止:
test_script.sh: line 10: 641 Aborted ./my_app $input1 $input2
ERROR: app failed with inputs: XXX YYY
如何防止“中止”的消息?
另请注意:该应用程序可能在标准C库“断言”声明上失败。
这并没有解决您的问题,但错误消息应该去标准错误,所以你的回声应该重定向。例如'echo'ERROR ...“>&2' – 2011-02-06 14:24:46