LPIC-1 Exam 102 (Linux Administrator) — Question 5
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 because the command 'env -u FOOBAR' removes the FOOBAR variable from the environment for the execution of ./myscript. Option A incorrectly attempts to unset the variable but does not affect the script's execution context. Option B initializes FOOBAR to an empty string, which still passes it to the script, and option D uses 'env -i', which would create an empty environment instead of just removing FOOBAR.