summaryrefslogtreecommitdiffstats
path: root/man/env.1
blob: e6a0908f46eee46e415ad6a6210d45d7730f2a74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.47.3.
.TH ENV "1" "March 2020" "GNU coreutils 8.32" "User Commands"
.SH NAME
env \- run a program in a modified environment
.SH SYNOPSIS
.B env
[\fI\,OPTION\/\fR]... [\fI\,-\/\fR] [\fI\,NAME=VALUE\/\fR]... [\fI\,COMMAND \/\fR[\fI\,ARG\/\fR]...]
.SH DESCRIPTION
.\" Add any additional description here
.PP
Set each NAME to VALUE in the environment and run COMMAND.
.PP
Mandatory arguments to long options are mandatory for short options too.
.TP
\fB\-i\fR, \fB\-\-ignore\-environment\fR
start with an empty environment
.TP
\fB\-0\fR, \fB\-\-null\fR
end each output line with NUL, not newline
.TP
\fB\-u\fR, \fB\-\-unset\fR=\fI\,NAME\/\fR
remove variable from the environment
.TP
\fB\-C\fR, \fB\-\-chdir\fR=\fI\,DIR\/\fR
change working directory to DIR
.TP
\fB\-S\fR, \fB\-\-split\-string\fR=\fI\,S\/\fR
process and split S into separate arguments;
used to pass multiple arguments on shebang lines
.TP
\fB\-\-block\-signal\fR[=\fI\,SIG\/\fR]
block delivery of SIG signal(s) to COMMAND
.TP
\fB\-\-default\-signal\fR[=\fI\,SIG\/\fR]
reset handling of SIG signal(s) to the default
.TP
\fB\-\-ignore\-signal\fR[=\fI\,SIG\/\fR]
set handling of SIG signals(s) to do nothing
.TP
\fB\-\-list\-signal\-handling\fR
list non default signal handling to stderr
.TP
\fB\-v\fR, \fB\-\-debug\fR
print verbose information for each processing step
.TP
\fB\-\-help\fR
display this help and exit
.TP
\fB\-\-version\fR
output version information and exit
.PP
A mere \- implies \fB\-i\fR.  If no COMMAND, print the resulting environment.
.PP
SIG may be a signal name like 'PIPE', or a signal number like '13'.
Without SIG, all known signals are included.  Multiple signals can be
comma\-separated.
.SH OPTIONS
.SS "\-S/\-\-split\-string usage in scripts"
The
.B \-S
option allows specifying multiple parameters in a script.
Running a script named
.B 1.pl
containing the following first line:
.PP
.RS
.nf
#!/usr/bin/env \-S perl \-w \-T
\&...
.fi
.RE
.PP
Will execute
.B "perl \-w \-T 1.pl".
.PP
Without the
.B '\-S'
parameter the script will likely fail with:
.PP
.RS
.nf
/usr/bin/env: 'perl \-w \-T': No such file or directory
.fi
.RE
.PP
See the full documentation for more details.
.PP
.SS "\-\-default-signal[=SIG]" usage
This option allows setting a signal handler to its default
action, which is not possible using the traditional shell
trap command.  The following example ensures that seq
will be terminated by SIGPIPE no matter how this signal
is being handled in the process invoking the command.

.PP
.RS
.nf
sh \-c 'env \-\-default-signal=PIPE seq inf | head \-n1'
.fi
.RE
.PP
.SH NOTES
POSIX's exec(2) pages says:
.RS
"many existing applications wrongly assume that they start with certain
signals set to the default action and/or unblocked.... Therefore, it is best
not to block or ignore signals across execs without explicit reason to do so,
and especially not to block signals across execs of arbitrary (not closely
cooperating) programs."
.RE
.SH AUTHOR
Written by Richard Mlynarik, David MacKenzie, and Assaf Gordon.
.SH "REPORTING BUGS"
GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
.br
Report any translation bugs to <https://translationproject.org/team/>
.SH COPYRIGHT
Copyright \(co 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
.br
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
.SH "SEE ALSO"
sigaction(2), sigprocmask(2), signal(7)
.PP
.br
Full documentation <https://www.gnu.org/software/coreutils/env>
.br
or available locally via: info \(aq(coreutils) env invocation\(aq