System Management
A Linux administrator has a script, setenv.sh, that contains 'export DB_HOST=db01.example.com'. After running the script from an interactive terminal, 'echo $DB_HOST' prints an empty line. The administrator needs DB_HOST to be set in the current shell session. Which action BEST meets the requirement?
Show the answer
Correct answerB. Run the script with source ./setenv.sh
Sourcing runs the script's commands inside the current shell, so the exported variable stays set there. Running it with bash or ./ starts a child process, and a child's exported variables are lost when it exits, which is why making it executable does not help.