GSEC · Question #165
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…
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
How the community answered
(23 responses)- A4% (1)
- B74% (17)
- C13% (3)
- D9% (2)
Why each option
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.
The mv command is used to move or rename files and directories, not to read or display the value of environment variables.
The echo command outputs the value of shell environment variables to standard output. In Linux, the $SHELL variable (conventionally uppercase, though the question uses lowercase) stores the path or name of the currently active shell. Running 'echo $shell' or 'echo $SHELL' prints that value directly to the terminal.
The rm command is used to remove files and directories from the filesystem, and has no function related to displaying variable values.
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
Source: https://www.gnu.org/software/bash/manual/bash.html
Topics
Community Discussion
No community discussion yet for this question.