Linux Foundation Certified System Administrator (LFCS) — Question 130
How can the existing environment variable FOOBAR be suppressed for the execution of the script./myscript only?
Answer options
- A. unset -v FOOBAR;./myscript
- B. set -a FOOBAR="";./myscript
- C. env -u FOOBAR./myscript
- D. env -i FOOBAR./myscript
Correct answer: C
Explanation
The correct answer is C, as 'env -u FOOBAR' removes the FOOBAR variable for the command that follows it, allowing ./myscript to run without it. Option A uses 'unset -v', which does not affect the environment during command execution. Option B sets FOOBAR to an empty string instead of removing it, and option D creates a new environment without any variables, which is not the goal of suppressing FOOBAR specifically.