Multiple choice technology operating systems

Which of the following will return the exit code of the last executed command?

  1. $%
  2. $#
  3. $?
  4. $!
Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The $? variable in shell scripting stores the exit code of the last executed command. A value of 0 typically indicates success, while non-zero values indicate various error conditions. This is essential for error handling and conditional logic in scripts.