Use this tag If your question revolves around determining or utilizing the exit status (return code) of a command. Common syntax involves the $? variable and the && and || symbols.
The exit status is an 8-bit integer value that is returned by a process; it is commonly used to determine success or failure of that process.
For further reading, see the POSIX page on Status Information.
To query the exit status of the most recent command, use the $? variable.
To execute a second command only if the first command was successful (returned a status of 0), use:
command-one && command-two
To execute a second command only if the first command failed (returned a non-zero status), use:
command-one || command-two
For more examples, see: What are the shell's control and redirection operators?