What does “$?” give us exactly in a shell script? [duplicate]
$? is a variable holding the return value of the last command you ran. Example C program (example.c): int main() { return 1; } Example Bash: gcc -o example example.c ./example echo $? # prints 1