variable

ENV

In interactive POSIX-mode Bash, selects a startup file through variable expansion. This file is executable shell source, not a passive configuration record. Use only trusted values. The test invokes an interactive child without terminal job control, captures diagnostics, and loads a synthetic file from a private HOME. Run in a fresh private directory with HOME set to that directory and LC_ALL=C. Expected output (one item per line): loaded.

Formal Syntax & Structure

bash syntaxbash
ENV

Return Value

shell variable

Expansion yields the current value; it has no independent command exit status.

Working Example

Example Snippetbash
printf 'BM_ENV=loaded\n' > startupHOME=$PWD ENV=$PWD/startup bash --noprofile --norc --posix -ic 'printf "%s\n" "$BM_ENV"' 2> startup.err
Bash Reference