简体   繁体   中英

error handling in unoconv

I have a script that automatically converts excel file from xls to csv using unoconv. 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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM