After a command finishes, the shell records a numeric exit status. By convention zero means success and nonzero indicates an error or another condition defined by that command. For example, a search tool may use a nonzero status for “no match,” not just a broken operation. Consult the command’s documentation for its meanings.
true
printf 'status: %s\n' "$?"
false
printf 'status: %s\n' "$?"
The output is status: 0 and then status: 1. $? is the status of the immediately preceding command; the first printf itself changes the status, so inspect or save it immediately. Text and status are separate: a program can print a message and fail, or succeed silently.
false && printf 'not printed\n'
true && printf 'continued\n'
false; printf 'runs anyway\n'
&& runs the next command only after success, so the second line prints continued but the first prints nothing. A semicolon separates commands without that condition, so the final line prints runs anyway. A pipeline may report only its last command’s status depending on the shell and settings; success of the last step alone does not establish that every earlier step succeeded.