When the command echo $ outputs 1, which of the following statements is true?
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.
Answer: C
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.
Reference: [LPI Linux Essentials – Topic 103: Command Line Basics]
[Bash Special Parameters]
[Exit status – Wikipedia]
Latest 102-500 Dumps Valid Version with 194 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund