Every Unix command returns a value on exit which the shell can interrogate. This value is held in the read-only shell variable $?.
A value of 0 (zero) signifies success; anything other than 0 (zero) signifies failure.