102-500 · Question #88
Which of the following commands lists all defines variables and functions within Bash?
The correct answer is D. set. set (D) lists all shell variables, environment variables, and functions defined in the current Bash session - making it the most comprehensive command for inspecting the shell's full state. Why the distractors are wrong: A. env - shows only exported environment variables, not…
Question
Options
- Aenv
- Bexport
- Cenv -a
- Dset
- Eecho $ENV
How the community answered
(27 responses)- A4% (1)
- B11% (3)
- C7% (2)
- D74% (20)
- E4% (1)
Explanation
set (D) lists all shell variables, environment variables, and functions defined in the current Bash session - making it the most comprehensive command for inspecting the shell's full state.
Why the distractors are wrong:
- A.
env- shows only exported environment variables, not shell-local variables or functions. - B.
export- with no arguments, lists only exported variables (similar toenv), not functions or unexported locals. - C.
env -a- not a standard flag;-ais not widely supported and even where it exists,envstill only covers environment variables. - E.
echo $ENV- prints the path to a startup file (if set), not a list of variables or functions.
Memory tip: Think of set as "see everything" - it's the broadest of the bunch. If you need just exported variables, use env or export; if you need everything (locals + globals + functions), use set.
Topics
Community Discussion
No community discussion yet for this question.