When you want to check/validate that a command ran fine, you need to recuperate its exit code. Again several ways:
command returnvalue=$?
returnvalue=$(command)$?