Tidy up the markup.
Approved by: re (blanket) OK'ed by: gad
This commit is contained in:
parent
0d0a2dff3b
commit
5dea8a444f
81
usr.bin/env/env.1
vendored
81
usr.bin/env/env.1
vendored
@ -83,7 +83,9 @@ Search the set of directories as specified by
|
||||
.Ar altpath
|
||||
to locate the specified
|
||||
.Ar utility
|
||||
program, instead of using the value of the PATH environment variable.
|
||||
program, instead of using the value of the
|
||||
.Ev PATH
|
||||
environment variable.
|
||||
.\" -S
|
||||
.It Fl S Ar string
|
||||
Split apart the given
|
||||
@ -119,8 +121,7 @@ is specified,
|
||||
prints out the names and values
|
||||
of the variables in the environment, with one name/value pair per line.
|
||||
.\"
|
||||
.Ss Details of -S (split-string) processing
|
||||
.Pp
|
||||
.Ss Details of Fl S Ss (split-string) processing
|
||||
The processing of the
|
||||
.Fl S
|
||||
option will split the given
|
||||
@ -133,7 +134,12 @@ specified as a separate argument on the original
|
||||
command.
|
||||
.Pp
|
||||
Spaces and tabs may be embedded in one of those new arguments by using
|
||||
single (``\ '\ '') or double (``"'') quotes, or backslashes (``\e'').
|
||||
single
|
||||
.Pq Dq Li '
|
||||
or double
|
||||
.Pq Ql \&"
|
||||
quotes, or backslashes
|
||||
.Pq Ql \e .
|
||||
Single quotes will escape all non-single quote characters, up to
|
||||
the matching single quote.
|
||||
Double quotes will escape all non-double quote characters, up to
|
||||
@ -167,7 +173,7 @@ sequences which represent some action to take.
|
||||
The character escape sequences are in backslash notation.
|
||||
The characters and their meanings are as follows:
|
||||
.Pp
|
||||
.Bl -tag -width Ds -offset indent -compact
|
||||
.Bl -tag -width indent -offset indent -compact
|
||||
.It Cm \ec
|
||||
Ignore the remaining characters in the
|
||||
.Ar string .
|
||||
@ -223,8 +229,11 @@ The processing of
|
||||
also supports substitution of values from environment variables.
|
||||
To do this, the name of the environment variable must be inside of
|
||||
.Ql ${} ,
|
||||
such as: ${SOMEVAR}.
|
||||
The common shell syntax of $SOMEVAR is not supported.
|
||||
such as:
|
||||
.Li ${SOMEVAR} .
|
||||
The common shell syntax of
|
||||
.Li $SOMEVAR
|
||||
is not supported.
|
||||
All values substituted will be the values of the environment variables
|
||||
as they were when the
|
||||
.Nm
|
||||
@ -274,19 +283,20 @@ So, if a script named
|
||||
.Pa /usr/local/bin/someport
|
||||
had a first line of:
|
||||
.Pp
|
||||
.D1 Li "#!/usr/local/bin/php -n -q -dsafe_mode=0"
|
||||
.Dl "#!/usr/local/bin/php -n -q -dsafe_mode=0"
|
||||
.Pp
|
||||
then the
|
||||
.Pa /usr/local/bin/php
|
||||
program would have been started with the arguments of:
|
||||
.Bd -literal -offset indent
|
||||
arg[0] = '/usr/local/bin/php'
|
||||
arg[1] = '-n'
|
||||
arg[2] = '-q'
|
||||
arg[3] = '-dsafe_mode=0'
|
||||
arg[4] = '/usr/local/bin/someport'
|
||||
.Ed
|
||||
.Pp
|
||||
.D1 Li "arg[0] = '/usr/local/bin/php'"
|
||||
.D1 Li "arg[1] = '-n'"
|
||||
.D1 Li "arg[2] = '-q'"
|
||||
.D1 Li "arg[3] = '-dsafe_mode=0'"
|
||||
.D1 Li "arg[4] = '/usr/local/bin/someport'"
|
||||
.Pp
|
||||
plus any arguments the user specifed when executing
|
||||
plus any arguments the user specified when executing
|
||||
.Pa someport .
|
||||
However, this processing of multiple options on the
|
||||
.Ql #!
|
||||
@ -297,26 +307,27 @@ So after a change which was made for
|
||||
release, that script will result in
|
||||
.Pa /usr/local/bin/php
|
||||
being started with the arguments of:
|
||||
.Bd -literal -offset indent
|
||||
arg[0] = '/usr/local/bin/php'
|
||||
arg[1] = '-n -q -dsafe_mode=0'
|
||||
arg[2] = '/usr/local/bin/someport'
|
||||
.Ed
|
||||
.Pp
|
||||
.D1 Li "arg[0] = '/usr/local/bin/php'"
|
||||
.D1 Li "arg[1] = '-n -q -dsafe_mode=0'"
|
||||
.D1 Li "arg[2] = '/usr/local/bin/someport'"
|
||||
.Pp
|
||||
plus any arguments the user specifed.
|
||||
plus any arguments the user specified.
|
||||
This caused a significant change in the behavior of a few scripts.
|
||||
In the case of above script, to have it behave the same way under
|
||||
.Fx 6.0
|
||||
as it did under earlier releases, the first line should be
|
||||
changed to:
|
||||
.Pp
|
||||
.D1 Li "#!/usr/bin/env -S /usr/local/bin/php -n -q -dsafe_mode=0"
|
||||
.Dl "#!/usr/bin/env -S /usr/local/bin/php -n -q -dsafe_mode=0"
|
||||
.Pp
|
||||
The
|
||||
.Nm
|
||||
utility will be started with the entire line as a single
|
||||
argument:
|
||||
.Pp
|
||||
.D1 Li "arg[1] = '-S /usr/local/bin/php -n -q -dsafe_mode=0'"
|
||||
.Dl "arg[1] = '-S /usr/local/bin/php -n -q -dsafe_mode=0'"
|
||||
.Pp
|
||||
and then
|
||||
.Fl S
|
||||
@ -335,7 +346,7 @@ if the name contains no
|
||||
.Ql /
|
||||
characters, unless the
|
||||
.Fl P
|
||||
option has been specifed.
|
||||
option has been specified.
|
||||
.Sh EXIT STATUS
|
||||
.Ex -std
|
||||
An exit status of 126 indicates that
|
||||
@ -356,9 +367,9 @@ The kernel processing of an interpreted script does not allow a script
|
||||
to directly reference some other script as its own interpreter.
|
||||
As a way around this, the main difference between
|
||||
.Pp
|
||||
.D1 Li #!/usr/local/bin/foo
|
||||
.Dl #!/usr/local/bin/foo
|
||||
and
|
||||
.D1 Li "#!/usr/bin/env /usr/local/bin/foo"
|
||||
.Dl "#!/usr/bin/env /usr/local/bin/foo"
|
||||
.Pp
|
||||
is that the latter works even if
|
||||
.Pa /usr/local/bin/foo
|
||||
@ -370,23 +381,26 @@ is to find the correct interpreter for a script, when the interpreter
|
||||
may be in different directories on different systems.
|
||||
The following example will find the
|
||||
.Ql perl
|
||||
interpreter by searching through the directories specifed by PATH.
|
||||
interpreter by searching through the directories specified by
|
||||
.Ev PATH .
|
||||
.Pp
|
||||
.D1 Li "#!/usr/bin/env perl"
|
||||
.Dl "#!/usr/bin/env perl"
|
||||
.Pp
|
||||
One limitation of that example is that it assumes the user's value
|
||||
for PATH is set to a value which will find the interpreter you want
|
||||
for
|
||||
.Ev PATH
|
||||
is set to a value which will find the interpreter you want
|
||||
to execute.
|
||||
The
|
||||
.Fl P
|
||||
option can be used to make sure a specific list of directories are
|
||||
option can be used to make sure a specific list of directories is
|
||||
used in the search for
|
||||
.Ar utility .
|
||||
Note that the
|
||||
.Fl S
|
||||
option is also required for this example to work correctly.
|
||||
.Pp
|
||||
.D1 Li "#!/usr/bin/env -S -P/usr/local/bin:/usr/bin perl"
|
||||
.Dl "#!/usr/bin/env -S -P/usr/local/bin:/usr/bin perl"
|
||||
.Pp
|
||||
The above finds
|
||||
.Ql perl
|
||||
@ -394,15 +408,16 @@ only if it is in
|
||||
.Pa /usr/local/bin
|
||||
or
|
||||
.Pa /usr/bin .
|
||||
That could be combined with the present value of PATH, to provide
|
||||
more flexibility.
|
||||
That could be combined with the present value of
|
||||
.Ev PATH ,
|
||||
to provide more flexibility.
|
||||
Note that spaces are not required between the
|
||||
.Fl S
|
||||
and
|
||||
.Fl P
|
||||
options:
|
||||
.Pp
|
||||
.D1 Li "#!/usr/bin/env -S-P/usr/local/bin:/usr/bin:${PATH} perl"
|
||||
.Dl "#!/usr/bin/env -S-P/usr/local/bin:/usr/bin:${PATH} perl"
|
||||
.Sh COMPATIBILITY
|
||||
The
|
||||
.Nm
|
||||
|
Loading…
Reference in New Issue
Block a user