How can the existing environment variable FOOBAR be suppressed for the execution of the script./myscript only?

How can the existing environment variable FOOBAR be suppressed for the execution of the script./myscript only?

A. unset -v FOOBAR;./myscript

B. set -a FOOBAR="";./myscript

C. env -u FOOBAR./myscript

D. env -i FOOBAR./myscript

Answer: C

Explanation:

The env command can be used to run a utility or command in a custom environment without having to modify the currently existing environment1. The -u or –unset option can be used to remove a variable from the environment12. Therefore, the command env -u FOOBAR./myscript will run the script./myscript in an environment where the variable FOOBAR is suppressed. The other options are incorrect for the following reasons:

A. unset -v FOOBAR;./myscript: This will unset the variable FOOBAR in the current shell, not just for the script execution. The semicolon (;) separates two commands, so the script will run in the same environment as the unset command.

B. set -a FOOBAR=“”;./myscript: This will set the variable FOOBAR to an empty string, not suppress

it. The -a option means that the variable will be exported to the environment of subsequent commands, so the script will still see the variable FOOBAR, but with no value.

D. env -i FOOBAR./myscript: This will run the script in an empty environment, not just suppress the variable FOOBAR. The -i or –ignore-environment option means that no environment variables will be passed to the command12.

Reference: env command in Linux with Examples – GeeksforGeeks, env – Wikipedia.

Latest 102-500 Dumps Valid Version with 194 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments