You can use:
system: You can catch exit code of the command
exec: Read de docs, your script will not continue normally
qx You can catch the STDOUT response
`` (the same of qx)
Try a
SuperSearch on this, the question has been asked many times; there are responses that could help you.
Hope this helps
Hopes