.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. .TH ENV "1" "January 2024" "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: .br Report any translation bugs to .SH COPYRIGHT Copyright \(co 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later . .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 .br or available locally via: info \(aq(coreutils) env invocation\(aq