Automation, Orchestration, and Scripting

An administrator sets BACKUP_DIR=/mnt/backup at an interactive Bash prompt and then runs ./backup.sh. The script reads $BACKUP_DIR but finds it empty. Which change makes the value available to the script?

Show the answer

Correct answerD. Run export BACKUP_DIR=/mnt/backup before starting the script

export marks the variable for the environment, so child processes such as the script inherit it. set with a name=value argument only replaces the positional parameters and does not create an environment variable, so the script still sees nothing.