env
env (of English environment , environment ') is a Unix command that either a list of environment variables indicating or another program in a different environment performs without changing the variables of the current environment. Environment variables can be changed, supplemented or deleted using env .
In addition, env can also be used to execute a shell script with the correct interpreter if the exact path to the interpreter is not known. In this case the actual function of env, the work on the environment variables, is not used.
Examples
Calling a new shell with an empty environment:
env - /bin/sh
Calling the X Window application xcalc if it should appear on another screen:
env DISPLAY=foo.bar:1.0 xcalc
A Python script that runs independently of the path of the Python interpreter:
#!/usr/bin/env python3
print("Hallo Welt")
Web links
-
env
: set the environment for command invocation - Open Group Base Specification -
env(1)
: set and print environment - OpenBSD General Commands Manual -
env(1)
: running a program in a changed environment - Debian GNU / Linux executables or shell commands man page