1ENV(1)                           User Commands                          ENV(1)
2
3
4

NAME

6       env - run a program in a modified environment
7

SYNOPSIS

9       env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]
10

DESCRIPTION

12       Set each NAME to VALUE in the environment and run COMMAND.
13
14       Mandatory  arguments  to  long  options are mandatory for short options
15       too.
16
17       -i, --ignore-environment
18              start with an empty environment
19
20       -0, --null
21              end each output line with NUL, not newline
22
23       -u, --unset=NAME
24              remove variable from the environment
25
26       -C, --chdir=DIR
27              change working directory to DIR
28
29       -S, --split-string=S
30              process and split S into separate arguments; used to pass multi‐
31              ple arguments on shebang lines
32
33       --block-signal[=SIG]
34              block delivery of SIG signal(s) to COMMAND
35
36       --default-signal[=SIG]
37              reset handling of SIG signal(s) to the default
38
39       --ignore-signal[=SIG]
40              set handling of SIG signal(s) to do nothing
41
42       --list-signal-handling
43              list non default signal handling to stderr
44
45       -v, --debug
46              print verbose information for each processing step
47
48       --help display this help and exit
49
50       --version
51              output version information and exit
52
53       A mere - implies -i.  If no COMMAND, print the resulting environment.
54
55       SIG  may  be  a  signal name like 'PIPE', or a signal number like '13'.
56       Without SIG, all known signals are included.  Multiple signals  can  be
57       comma-separated.  An empty SIG argument is a no-op.
58
59   Exit status:
60       125    if the env command itself fails
61
62       126    if COMMAND is found but cannot be invoked
63
64       127    if COMMAND cannot be found
65
66       -      the exit status of COMMAND otherwise
67

OPTIONS

69   -S/--split-string usage in scripts
70       The  -S option allows specifying multiple parameters in a script.  Run‐
71       ning a script named 1.pl containing the following first line:
72
73              #!/usr/bin/env -S perl -w -T
74              ...
75
76       Will execute perl -w -T 1.pl .
77
78       Without the '-S' parameter the script will likely fail with:
79
80              /usr/bin/env: 'perl -w -T': No such file or directory
81
82       See the full documentation for more details.
83
84   --default-signal[=SIG] usage
85       This option allows setting a signal  handler  to  its  default  action,
86       which  is  not  possible using the traditional shell trap command.  The
87       following example ensures that seq will be  terminated  by  SIGPIPE  no
88       matter  how  this  signal  is being handled in the process invoking the
89       command.
90
91
92              sh -c 'env --default-signal=PIPE seq inf | head -n1'
93

NOTES

95       POSIX's exec(3p) pages says:
96              "many existing applications wrongly assume that they start  with
97              certain  signals  set to the default action and/or unblocked....
98              Therefore, it is best not to block or ignore signals across  ex‐
99              ecs  without  explicit  reason  to  do so, and especially not to
100              block signals across execs of arbitrary (not  closely  cooperat‐
101              ing) programs."
102

AUTHOR

104       Written by Richard Mlynarik, David MacKenzie, and Assaf Gordon.
105

REPORTING BUGS

107       GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
108       Report any translation bugs to <https://translationproject.org/team/>
109
111       Copyright  ©  2023  Free Software Foundation, Inc.  License GPLv3+: GNU
112       GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
113       This is free software: you are free  to  change  and  redistribute  it.
114       There is NO WARRANTY, to the extent permitted by law.
115

SEE ALSO

117       sigaction(2), sigprocmask(2), signal(7)
118
119       Full documentation <https://www.gnu.org/software/coreutils/env>
120       or available locally via: info '(coreutils) env invocation'
121
122
123
124GNU coreutils 9.3               September 2023                          ENV(1)
Impressum