What does
echo $?
mean in shell programming?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is the exit status of the last executed command.
For example the command
truealways returns a status of0andfalsealways returns a status of1:From the manual: (acessible by calling
man bashin your shell)By convention an exit status of
0means success, and non-zero return status means failure. Learn more about exit statuses on wikipedia.There are other special variables like this, as you can see on this online manual: https://www.gnu.org/s/bash/manual/bash.html#Special-Parameters