Which statement correctly describes the shell parameters $@, $$, and $!?

Study for the OSCP Linux Exam. Use our flashcards and multiple-choice questions to test your skills. Each query comes with detailed hints and explanations to enhance your preparedness. Get ready to conquer the exam!

Multiple Choice

Which statement correctly describes the shell parameters $@, $$, and $!?

Explanation:
Understanding shell parameters: $@ represents all positional parameters. When used as "$@", it expands to each argument as a separate, properly quoted word, preserving spaces inside arguments. The current shell’s process ID is given by $$. The PID of the most recently started background job is $!, which is the PID of the last background process you launched (for example, with &). So the statement that describes these three correctly—$@ as all command arguments (each argument as a separate quoted item), $$ as the PID of the current shell, and $! as the PID of the last background process—is the right one. The other descriptions misstate one or more of these parameters (such as mislabeling what $@, $$, or $! expand to).

Understanding shell parameters: $@ represents all positional parameters. When used as "$@", it expands to each argument as a separate, properly quoted word, preserving spaces inside arguments. The current shell’s process ID is given by $$. The PID of the most recently started background job is $!, which is the PID of the last background process you launched (for example, with &). So the statement that describes these three correctly—$@ as all command arguments (each argument as a separate quoted item), $$ as the PID of the current shell, and $! as the PID of the last background process—is the right one. The other descriptions misstate one or more of these parameters (such as mislabeling what $@, $$, or $! expand to).

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy