A Linux administrator is writing a security script that temporarily stores a sensitive API key in a shell variable named TEMP_API_KEY. After the key is used, the administrator wants to ensure the variable and its value are completely removed from the current shell session to prevent accidental exposure.
Which of the following commands should the administrator use to achieve this?
The correct command to completely remove a shell variable is unset. The unset builtin deletes the variable (or function) from the shell's memory so it behaves as if it were never defined.
TEMP_API_KEY="" only sets the variable to an empty string; the variable remains set.
export TEMP_API_KEY= sets the variable to an empty string and marks it for export, leaving it present in the environment.
rm TEMP_API_KEY deletes files or directories, not shell variables.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does the 'unset' command do in Linux?
Open an interactive chat with Bash
How does 'unset' differ from setting a variable to an empty string?
Open an interactive chat with Bash
Why doesn't the 'rm' command work for removing shell variables?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Automation, Orchestration, and Scripting
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access