QuestionQ205

Essential Commands

How can the existing environment variable FOOBAR be suppressed only when executing the ./myscript script?

  • A unset -v FOOBAR;./myscript
  • B set -a FOOBAR="";./myscript
  • C env -u FOOBAR./myscript
  • D env -i FOOBAR./myscript
Explanation

The env -u FOOBAR form removes FOOBAR from the environment of the command it launches, without unsetting it in the invoking shell or discarding other environment variables. This applies the suppression only to the script execution.

Community Discussion

No comments yet. Be the first to start the discussion!