What Does $? Do in Linux?
Contents the $? Variable Represents the Exit Status of the Previous Command. Exit Status Is a Numerical Value Returned by Every Command Upon Its Completion. as...
The $? variable represents the exit status of the previous command. Exit status is a numerical value returned by every command upon its completion. As a rule, most commands return an exit status of 0 if they were successful, and 1 if they were unsuccessful.
What is $? In Shell?
$? is a special variable in shell that reads the exit status of the last command executed. After a function returns, $? gives the exit status of the last command executed in the function.
Must Read
What does $? Do in bash?
In Bash, $? expression prints the status of the last command executed. ~$ echo $? Our last command was test 5 -gt 9 and it exited with status 1 which means the expression 5 -gt 9 is false .