Bash Scripting - Error HandlingWhich bash variable holds the exit code of the last executed command?A$#B$!C$$D$?Check Answer
Step-by-Step SolutionSolution:Step 1: Recall special bash variablesBash uses special variables for different purposes: $? for last exit code, $! for last background PID, $# for argument count, $$ for current PID.Step 2: Identify the exit code variableThe variable $? stores the exit code of the last command executed.Final Answer:$? -> Option DQuick Check:Exit code variable = $? [OK]Quick Trick: Use $? to check last command's success or failure [OK]Common Mistakes:MISTAKESUsing $! instead of $?Confusing with $$ or $#
Master "Error Handling" in Bash Scripting9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Bash Scripting Quizzes Arrays - Why arrays handle lists of data - Quiz 7medium Arrays - Array slicing - Quiz 6medium Error Handling - Why error handling prevents silent failures - Quiz 1easy File Operations in Scripts - File existence checks - Quiz 13medium Functions - Function arguments ($1, $2 inside function) - Quiz 2easy Functions - Why functions organize reusable code - Quiz 3easy String Operations - String length (${#var}) - Quiz 11easy Text Processing in Scripts - grep in scripts - Quiz 1easy Text Processing in Scripts - Here strings (<<<) - Quiz 13medium Text Processing in Scripts - Why scripts often process text - Quiz 10hard