mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
test/[: remove effectively inaccessible self-doc
Did you know that you could get a manual page for the 'test'/'[' builtin command using one of these strange command lines? test --man -- [ --man -- ] Neither did I. It's not documented or mentioned anywhere (and this syntax violates POSIX). So nobody knows about it, which makes that documentation useless. (The regular --man option doesn't work because that would break 'test'.) I only found out how to invoke it when I understood what the uncommented C code handling this does. The test/[ command's self-documentation is unmaintained since 2003 and somewhat incomplete. It's also mostly redundant with the documentation on Conditional Expressions in the main (k)sh.1 manual page. But unlike the latter, this is resident in RAM, wasting working memory in every shell process. src/cmd/ksh93/sh.1: - Add documentation for 'test'/'[' commands (yes, they were not mentioned in the main manual page until now), describing them in terms of differences from '[[' and recommending the latter. src/cmd/ksh93/include/test.h, src/cmd/ksh93/bltins/test.c, src/cmd/ksh93/data/testops.c: - Remove RAM-resident --man doc for test/[ command. - Remove the bizarre option parsing that allowed invoking it.
This commit is contained in:
parent
cd2cf236c2
commit
fa6a180fdd
4 changed files with 24 additions and 119 deletions
|
@ -5494,7 +5494,7 @@ The command only expands parameters.
|
|||
.br
|
||||
.ne 2
|
||||
.TP
|
||||
\(dg \f3\|. \f2name\^\fP \*(OK \f2arg\^\fP .\|.\|. \*(CK
|
||||
\(dg \f3\|.\fP \f2name\^\fP \*(OK \f2arg\^\fP .\|.\|. \*(CK
|
||||
If
|
||||
.I name\^
|
||||
is a function defined with the
|
||||
|
@ -5525,6 +5525,10 @@ command and the original positional parameters are restored upon completion.
|
|||
Otherwise the positional parameters are unchanged.
|
||||
The exit status is the exit status of the last command executed.
|
||||
.TP
|
||||
\f3[\fP \f2expression\fP \f3]\fP
|
||||
The \f3[\fP command is the same as \f3test\fP, with the exception that an
|
||||
additional closing \f3]\fP argument is required. See \f3test\fP below.
|
||||
.TP
|
||||
\f3alias\fP \*(OK \f3\-ptx\fP \*(CK \*(OK \f2name\fP\*(OK \f3=\fP\f2value\^\fP \*(CK \*(CK .\|.\|.
|
||||
.B alias\^
|
||||
with no arguments prints the list of aliases
|
||||
|
@ -7198,6 +7202,24 @@ in the parent shell). Equivalent to
|
|||
.BR kill\ -s\ STOP\ "$$" ,
|
||||
except that it accepts no operands and refuses to suspend a login shell.
|
||||
.TP
|
||||
\f3test\fP \f2expression\fP
|
||||
The \f3test\fP and \f3[\fP commands execute conditional expressions similar
|
||||
to those specified for the \f3[[\fP compound command under
|
||||
.I Conditional Expressions
|
||||
above, but with several important differences. The \f3=\fP, \f3==\fP and
|
||||
\f3!=\fP operators test for string (in)equality without pattern matching;
|
||||
the \f3==\fP variant is nonstandard and should not be used. The \f3=\(ap\fP,
|
||||
\f3<\fP, \f3>\fP, \f3&&\fP and \f3||\fP operators are not available. Most
|
||||
importantly, as \f3test\fP and \f3[\fP are simple regular commands, field
|
||||
splitting and file name generation \f2are\fP performed on all their
|
||||
arguments and all aspects of regular shell grammar (such as redirection)
|
||||
remain active. This is usually harmful, so care must be taken to quote
|
||||
arguments and expansions to avoid this. There are also certain inherent
|
||||
grammatical ambiguities in the expressions. To avoid the many pitfalls
|
||||
arising from these issues, the \f3[[\fP compound command should be used
|
||||
instead. The primary purpose of the \f3test\fP and \f3[\fP commands is
|
||||
compatibility with other shells that lack \f3[[\fP.
|
||||
.TP
|
||||
\f3times\fP
|
||||
Displays the accumulated user and system CPU times, one line with the times
|
||||
used by the shell and another with those used by all of the shell's child
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue