When the command echo $ outputs 1, which of the following statements is true?
A.
It is the process ID of the echo command.
B.
It is the process ID of the current shell.
C.
It is the exit value of the command executed immediately before echo.
D.
It is the exit value of the echo command.
The Answer Is:
C
This question includes an explanation.
Explanation:
The $? variable in bash is a special parameter that holds the exit status of the last command executed in the current shell. The exit status is a numerical value that indicates whether the command was successful (zero) or failed (non-zero). The echo command simply prints its arguments to the standard output. Therefore, when the command echo $? outputs 1, it means that the previous command failed with an exit status of 1. References:
[LPI Linux Essentials - Topic 103: Command Line Basics]
[Bash Special Parameters]
[Exit status - Wikipedia]
102-500 PDF/Engine
Printable Format
Value of Money
100% Pass Assurance
Verified Answers
Researched by Industry Experts
Based on Real Exams Scenarios
100% Real Questions
Get 65% Discount on All Products,
Use Coupon: "ac4s65"