doc: document the c-maybe quoting style
[coreutils.git] / man / env.x
blob5596cb34c28616385cc0857acada1a90d81ac141
1 '\" Copyright (C) 1998-2024 Free Software Foundation, Inc.
2 '\"
3 '\" This is free software.  You may redistribute copies of it under the terms
4 '\" of the GNU General Public License <https://www.gnu.org/licenses/gpl.html>.
5 '\" There is NO WARRANTY, to the extent permitted by law.
6 [NAME]
7 env \- run a program in a modified environment
8 [DESCRIPTION]
9 .\" Add any additional description here
10 [OPTIONS]
11 .SS "\-S/\-\-split\-string usage in scripts"
12 The
13 .B \-S
14 option allows specifying multiple parameters in a script.
15 Running a script named
16 .B 1.pl
17 containing the following first line:
18 .PP
19 .RS
20 .nf
21 #!/usr/bin/env \-S perl \-w \-T
22 \&...
23 .fi
24 .RE
25 .PP
26 Will execute
27 .B "perl \-w \-T 1.pl".
28 .PP
29 Without the
30 .B '\-S'
31 parameter the script will likely fail with:
32 .PP
33 .RS
34 .nf
35 /usr/bin/env: 'perl \-w \-T': No such file or directory
36 .fi
37 .RE
38 .PP
39 See the full documentation for more details.
40 .PP
41 .SS "\-\-default-signal[=SIG]" usage
42 This option allows setting a signal handler to its default
43 action, which is not possible using the traditional shell
44 trap command.  The following example ensures that seq
45 will be terminated by SIGPIPE no matter how this signal
46 is being handled in the process invoking the command.
48 .PP
49 .RS
50 .nf
51 sh \-c 'env \-\-default-signal=PIPE seq inf | head \-n1'
52 .fi
53 .RE
54 .PP
56 [NOTES]
57 POSIX's exec(3p) pages says:
58 .RS
59 "many existing applications wrongly assume that they start with certain
60 signals set to the default action and/or unblocked.... Therefore, it is best
61 not to block or ignore signals across execs without explicit reason to do so,
62 and especially not to block signals across execs of arbitrary (not closely
63 cooperating) programs."
64 .RE
66 [SEE ALSO]
67 sigaction(2), sigprocmask(2), signal(7)