You can have either of two types of problems. Test for each separately because you probably want to respond to each differently. Choose one of the suggested methods to verify that the command ran without error. If successful, use a regex to verify that the result is "reasonable" for your calculations.