LFCS · Question #803
Which of the following commands is used to change options and positional parameters for a running Bash?
The correct answer is B. set. The set command in Bash is used to manipulate shell options and positional parameters for the current shell session.
Question
Options
- Ahistory
- Bset
- Cbashconf
- Dsetsh
- Eenvsetup
How the community answered
(52 responses)- B90% (47)
- C2% (1)
- D4% (2)
- E4% (2)
Why each option
The `set` command in Bash is used to manipulate shell options and positional parameters for the current shell session.
`history` is used to display or manipulate the command history list, not shell options or parameters.
The `set` command is a Bash built-in that allows users to modify shell options, such as `set -o noclobber` to prevent overwriting files, and to assign or display positional parameters like `$1`, `$2`, etc. These changes directly affect the behavior of the currently running Bash shell.
`bashconf` is not a standard Bash command for configuring a running shell.
`setsh` is not a standard Bash command for altering shell settings.
`envsetup` is not a standard Bash command used to change shell options or parameters.
Concept tested: Bash shell options and positional parameters
Source: https://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin
Topics
Community Discussion
No community discussion yet for this question.