maux
Star on GitHub Buy me a coffee

Manual / env

env(1)

ENV(1) General Commands Manual ENV(1)

env - run a utility in a modified environment, or print it

env [ -i ] [ name=value ] ... [ utility [ argument ] ... ]

Env obtains the current environment, modifies it according to its -i and name=value operands, and either prints the result (one name=value per line, if no utility was given) or runs utility with it.

Start from an empty environment rather than this process's own.
Add name to the environment with the given value, or replace it if name is already there. Any number of these may precede utility; the first operand containing no = ends them and is taken as utility.

Utility is resolved against PATH exactly as a shell resolves a bare command word (execvp), and its argv[0] is the word as typed, not the resolved path. Env exits with utility's own exit status.

/usr/man/ENV this page

sh(1), xargs(1), printf(1)

Exit status is that of utility if it ran; 127 if it could not be found on PATH; 126 if it was found but could not be run; 1 on a usage error, a too-large argument list or environment (internal caps: 48 environment entries, 32 argument words), or if the kernel itself refuses the environment or argument list as too large; 0 if env only printed the environment.

A name given more than once among the name=value operands is resolved by ORDER (the last one typed wins for any program that looks it up), not by removing the earlier one -- a program that enumerates its own environment in full, rather than looking up one name, may see both. No real shell ever exports a duplicate name, so this has not mattered in practice. "Found but could not be run" (exit 126) cannot be distinguished here from other spawn failures below the two caps above -- this machine's ProDOS has no separate execute-permission bit to test.

September 14, 2026 maux