bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in test


From: Bob Proulx
Subject: Re: Bug in test
Date: Mon, 30 Nov 2009 23:14:09 -0700
User-agent: Mutt/1.5.18 (2008-05-17)

Please take care to make sure the mailing list is included in your
reply so that others may share in the discussion.  You can do this by
using the reply-to-mailing-list function.  Or lacking that use
reply-to-all.

> thanks for your reply, I see your point. In this case, the manpage seems  
> to bee irritating: (Qutoing from the manpage)

> SYNOPSIS

The synopsis is the part that shows how it works.

>       test EXPRESSION
>       test

Neither of those show any options.  So 'test' does not handle any
options.

>       [ EXPRESSION ]
>       [ ]
>       [ OPTION

The last shows the OPTION listing.  So (as Eric noted in his
follow-up) only the '[' command can take options.  But it is also a
shell builtin.  So you must avoid the shell's version and call out the
external one explicitly.

  /usr/bin/[ --version

  /usr/bin/[ --help

Since both 'test' and '[' are shell builtins it is unusual to ever
actually use the external ones.  Most of the time the shell builtin
versions will be used.  That is the desirable case since it is so much
faster than launching the external command.  The external ones are
provided so that a program (such as a C program) can exec(2) them.  If
they were only shell builtins then an exec(2) of them would fail.  And
originally they were external standalone programs so removing them
would have been a regression, some decades ago.

Bob


Florian Lehmann wrote:
> Hi Bob,
>
> thanks for your reply, I see your point. In this case, the manpage seems  
> to bee irritating: (Qutoing from the manpage)
>
> TEST(1)                          User Commands                          
> TEST(1)
>
> NAME
>       test - check file types and compare values
>
> SYNOPSIS
>       test EXPRESSION
>       test
>
>       [ EXPRESSION ]
>       [ ]
>       [ OPTION
>
> DESCRIPTION
>       Exit with the status determined by EXPRESSION.
>
>       --help display this help and exit
>
>       --version
>              output version information and exit
>
> In which case is test supposed to display the help when called with the   
> option --help?
>
> Best regards,
> Florian Lehmann




reply via email to

[Prev in Thread] Current Thread [Next in Thread]