Intermediate Linux & Shell Scripting
Q54 / 100

What is the purpose of "$?" in bash?

Correct! Well done.

Incorrect.

The correct answer is A) It holds the exit status (return code) of the most recently executed command, where 0 typically indicates success and non-zero indicates failure

A

Correct Answer

It holds the exit status (return code) of the most recently executed command, where 0 typically indicates success and non-zero indicates failure

Explanation

After any command runs, "$?" contains its exit code, commonly checked in scripts to determine whether a previous command succeeded (0) or failed (non-zero) before proceeding.

Progress
54/100