102-500 Exam QuestionsBrowse all questions from this exam

102-500 Exam - Question 75


What information is shown by the echo $? command?

Show Answer
Correct Answer: B

The echo $? command displays the exit value of the command executed immediately before echo. This exit value is a numerical code that represents whether the previous command was successful (usually 0) or encountered an error (non-zero value).

Discussion

2 comments
Sign in to comment
CuriousLinuxCatOption: B
Aug 8, 2021

Correct Answer: B ☜ is correct. What does the 'echo $?' command do? It shows the most recently exit code. The command's exit code right before you entered 'echo $?'. Examples: true echo $? 0 false echo $? 1 ls -fasjfhslakfjh echo $? 2 (The two here represents "Misuse of Shell Built-in") See more: https://www.baeldung.com/linux/status-codes https://unix.stackexchange.com/questions/501128/what-does-echo-do

iwkno6Option: B
Aug 27, 2021

B is correct. To test, type a common command and then echo $? and check the output, then type some gibberish and do echo $? and check the output again. it shoudl display the exit code depending on the previous command