Your Question: What Is Question Mark in Linux?

Your Question: What Is Question Mark in Linux?
Contents

This control operator is used to check the status of last executed command. If status shows ‘0’ then command was successfully executed and if shows ‘1’ then command was a failure. The exit code of the previous command is stored in the shell variable $?.

What is the meaning of $?

$? expands to the exit status of the most recently executed foreground pipeline. … In simpler terms, it’s the exit status of the last command.

What is $? In Bash?

$? is a special variable in bash that always holds the return/exit code of the last executed command. You can view it in a terminal by running echo $? . Return codes are in the range [0; 255]. A return code of 0 usually means everything is ok.

Sarah Jenkins
Author

Sarah Jenkins

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.