QuestionQ80Verified/Essential CommandsCopy linkReport a problemAsk AstroTutorSave questionIf running the command echo $$ produces the output 12942, what does the value 12942 represent?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.Show AnswerAnswerExplanationIn shell scripting (e.g., Bash), $$ is a special parameter that expands to the process ID (PID) of the current shell. This is distinct from $!, which holds the PID of the most recently executed background command, and $?, which holds the exit status of the last executed command. Therefore, echo $$ prints the PID of the shell instance running the command.Learn moreBash Reference Manual - Special ParametersShow comments0Show commentsCommunity DiscussionNo comments yet. Be the first to start the discussion!
Community Discussion