- All Exams Instant Download
Which of the following commands lists all defined variables and functions within Bash?
Which of the following commands lists all defined variables and functions within Bash?
A . env
B . set
C . env -a
D . echo $ENV
Answer: B
B
you can set functions with set. you can also unset them with:
unset -f (function_name)
I mean it’s B, not A.
It’s A.
env does not list functions
Refer to the link below.
https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
“If no options or arguments are supplied, set displays the names and values of all shell variables and functions”
Answer should be A, env command used to view environment variables for the current shell. set command is used to define and determine the values of the system environment.