Bash & Shell Scripting (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)
What are Exit Codes (`$?`) and how does Bash indicate success or failure?
junior Levelbash-shellBasic
In Simple Words: Every Linux command returns an integer exit status (0 to 255) upon termination:
0: Success / No errors.- Non-zero (1 to 255): Failure or error (e.g. 1 = General error, 2 = Misuse of shell builtins, 127 = Command not found).
- The special variable
$?holds the exit code of the most recently executed command.