[英]error handling in unoconv
I have a script that automatically converts excel file from xls to csv using unoconv. 我有一个脚本,可以使用unoconv自动将excel文件从xls转换为csv。 From time to time I'm getting this error. 我不时收到此错误。
line 174: 21023 Segmentation fault unoconv -f csv "$FILES"
I want to be able to handle any error that occurs upon conversion. 我希望能够处理转换时发生的任何错误。 I've tried adding this to the script. 我尝试将其添加到脚本中。
unoconv -f csv "$FILES"
if [ $? -ne 0 ]; then
echo "error encountered when converting from xls to csv"
else
echo "Successfully converted to csv"
fi
My problem is that. 我的问题是。 Even if I encounter that error. 即使我遇到该错误。 The error message is not being reflected. 错误消息未得到反映。 Is there anything I'm doing wrong? 我做错了什么吗?
try something like: 尝试类似:
unoconv -f csv "$FILES" 2>&1 | grep -i "Segmentation fault" &>/dev/null \
&& echo "error encountered when converting from xls to csv" \
|| echo "Successfully converted to csv"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.