During a troubleshooting session, you discover that the identifier BACKUP exists both as an exported shell variable and as a command alias in your interactive Bash shell:
$ echo "$BACKUP"
/srv/backups
$ type BACKUP
BACKUP is aliased to 'rsync -av --delete'
Before you run a script that references $BACKUP as a variable, you need to remove only the alias so the variable (and its export status) remains unchanged. Which single command should you run?
The unalias built-in permanently deletes the specified alias from the current shell session without affecting any variable that happens to have the same name. Once the alias BACKUP is removed, commands and scripts will resolve BACKUP only as the exported variable whose value is /srv/backups.
unset BACKUP would instead delete the variable (and any function of the same name) and therefore remove the path your script requires. export -n BACKUP strips the export attribute from the variable but leaves the conflicting alias in place, so the alias would still shadow the variable when BACKUP is used as a command. alias -d BACKUP is not a valid option in Bash for deleting an alias. Consequently, unalias BACKUP is the only command that meets the requirement.
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 is the purpose of the 'unalias' command in Bash?
Open an interactive chat with Bash
How do exported variables work and why are they important in Bash scripts?
Open an interactive chat with Bash
Why does Bash prioritize aliases over variables or functions with the same name?
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