Forum How do I...?

Properly check for success/failure when using Command Line utility within another script

ccopac
I'm looping through a series of HTML files in a bash script and converting each one to PDF using the command line utility, and I was wondering what the proper/recommended way to check for success or failure/warning would be?

result=`prince $file -o $OUTPUT_PDF_DIR/$filename.pdf`
echo "Result: $result"

Is it safe to just test for a non-empty $result in this example and treat that as a failure/warning to be reviewed? Is there a more appropriate way I'm not thinking of?
mikeday
Checking warnings and errors would make sense, yes. You could also check the process exit code.