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 signals(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.
58

OPTIONS

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

NOTES

86       POSIX's exec(2) pages says:
87              "many existing applications wrongly assume that they start  with
88              certain  signals  set to the default action and/or unblocked....
89              Therefore, it is best not to  block  or  ignore  signals  across
90              execs  without  explicit  reason to do so, and especially not to
91              block signals across execs of arbitrary (not  closely  cooperat‐
92              ing) programs."
93

AUTHOR

95       Written by Richard Mlynarik, David MacKenzie, and Assaf Gordon.
96

REPORTING BUGS

98       GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
99       Report any translation bugs to <https://translationproject.org/team/>
100
102       Copyright  ©  2020  Free Software Foundation, Inc.  License GPLv3+: GNU
103       GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
104       This is free software: you are free  to  change  and  redistribute  it.
105       There is NO WARRANTY, to the extent permitted by law.
106

SEE ALSO

108       sigaction(2), sigprocmask(2), signal(7)
109
110       Full documentation <https://www.gnu.org/software/coreutils/env>
111       or available locally via: info '(coreutils) env invocation'
112
113
114
115GNU coreutils 8.32                April 2020                            ENV(1)
Impressum