commands
env — run with a modified environment
GNU env runs an external command with modified environment entries; without a command it prints environment values, which may contain secrets. Example assumes a fresh shell lab fixture with new output names.
Formal Syntax & Structure
linux syntaxlinux
env [OPTION]... [NAME=VALUE]... [COMMAND [ARG...]]Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| NAME=VALUE | operand | environment assignment |
| COMMAND | operand | External executable; if omitted, prints the resulting environment (avoid exposing secrets). |
| ARG | operand | arguments |
| -i | option | Start with an empty environment; then apply supplied assignments. |
Return Value
exit status and output
GNU env runs an external command with modified environment entries; without a command it prints environment values, which may contain secrets.
Working Example
Example Snippetlinux
env BM_MODE=preview bash -c 'printf "%s\n" "$BM_MODE"'