GIAC
GSEC · Question #165
GSEC Question #165: Real Exam Question with Answer & Explanation
The correct answer is B. echo $shell. The echo command prints the value of environment variables to the terminal, making it the correct way to display the current shell stored in the $SHELL variable.
Question
You work as a Network Administrator for McNeil Inc. The company has a Linux-based network. David, a Sales Manager, wants to know the name of the shell that he is currently using. Which of the following commands will he use to accomplish the task?
Options
- Amv $shell
- Becho $shell
- Crm $shell
- Dls $shell
Explanation
The echo command prints the value of environment variables to the terminal, making it the correct way to display the current shell stored in the $SHELL variable.
Common mistakes.
- A. The mv command is used to move or rename files and directories, not to read or display the value of environment variables.
- C. The rm command is used to remove files and directories from the filesystem, and has no function related to displaying variable values.
- D. The ls command lists the contents of a directory and cannot be used to print the value of an environment variable.
Concept tested. Linux echo command displaying shell environment variables
Reference. https://www.gnu.org/software/bash/manual/bash.html
Community Discussion
No community discussion yet for this question.