Guys any tips on printing a certain error message to stderr and exiting should a command fail within a ksh script? I'm trying to null some output files.
Touch isn't suitable as i need to null them.
print "" > file isn't suitable as i need to check elsehere for if they are 0bytes or not.
I've tried these below examples and none work correctly. I don't want to have to put a check after each command as :-
Code:
if [[ $? -ne 0 ]];then
print "error blah blah" >&2
exit 2
fi