nerdexam
Linux_Foundation

LFCS · Question #4

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

The correct answer is C. env -u FOOBAR./myscript. The env command with the -u option can temporarily remove a specified environment variable for the duration of a single command's execution.

Submitted by parkjh· Apr 18, 2026Essential Commands

Question

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

Options

  • Aunset -v FOOBAR;./myscript
  • Bset -a FOOBAR="";./myscript
  • Cenv -u FOOBAR./myscript
  • Denv -i FOOBAR./myscript

How the community answered

(24 responses)
  • A
    4% (1)
  • B
    4% (1)
  • C
    83% (20)
  • D
    8% (2)

Why each option

The `env` command with the `-u` option can temporarily remove a specified environment variable for the duration of a single command's execution.

Aunset -v FOOBAR;./myscript

`unset -v FOOBAR; ./myscript` would permanently unset `FOOBAR` in the current shell, not just for the `myscript` execution.

Bset -a FOOBAR="";./myscript

`set -a FOOBAR=""; ./myscript` would export `FOOBAR` with an empty string value to the script, not suppress or unset it from the environment.

Cenv -u FOOBAR./myscriptCorrect

The `env -u FOOBAR ./myscript` command executes `./myscript` with the `FOOBAR` environment variable specifically unset from its environment, without affecting the `FOOBAR` variable in the calling shell.

Denv -i FOOBAR./myscript

`env -i ./myscript` would start `./myscript` with an entirely empty environment (except for any variables explicitly specified with `env`), which is more drastic than just suppressing `FOOBAR`.

Concept tested: `env` command for environment modification

Source: https://www.gnu.org/software/coreutils/manual/html_node/env-invocation.html

Topics

#Environment Variables#env command#Shell Execution#Process Environment

Community Discussion

No community discussion yet for this question.

Full LFCS Practice