Linux_FoundationLinux_Foundation
LFCS · Question #2
LFCS Question #2: Real Exam Question with Answer & Explanation
The correct answer is B: It is the process ID of the current shell.. The special shell variable $$ expands to the process ID (PID) of the shell instance that is currently executing the command.
Submitted by devops_kid· Apr 18, 2026Essential Commands
Question
When the command echo $$ outputs 12942, what is the meaning of 12942?
Options
- AIt is the process ID of the echo command.
- BIt is the process ID of the current shell.
- CIt is the process ID of the last command executed.
- DIt is the process ID of the last command which has been placed in the background.
Explanation
The special shell variable $$ expands to the process ID (PID) of the shell instance that is currently executing the command.
Common mistakes.
- A. The
$$variable does not represent the process ID of theechocommand itself;echoruns as a child process and would have a different PID. - C. The
$$variable specifically refers to the current shell's PID, not the PID of the last command executed, which would typically be a different value. - D. The
$$variable refers to the current shell's PID, while the PID of the last command placed in the background is stored in the$!variable.
Concept tested. Shell special variable $$ (current shell PID)
Reference. https://www.gnu.org/software/bash/manual/bash.html#Special-Parameters
Topics
#Shell variables#Process ID (PID)#Bash shell#Command line basics
Community Discussion
No community discussion yet for this question.