[Top][All Lists]

[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 15:39:11 -0700
User-agent: Mutt/1.5.18 (2008-05-17)

Florian Lehmann wrote:
> I recently recognised a missfunktion in coreutil test. When calling test  
> with option --help, test does not print anything and returns with  
> exit-code 0.

Thanks for your report.  But what you are seeing is not a bug in test
but is instead simply a misunderstanding of how it is used.  The
'test' behavior has been around for decades and the use is
standardized upon previously existing behavior.

Two points are of interest about your test --help question.  One is
that unless you are careful you are getting the shell builtin test and
not the external standalone test program.

  $ type test
  test is a shell builtin

Two and the main point of your issue is that test is required to
evaluate the expression very specifically based upon the total number
of arguments.  Since your case "test --help" provides only one
argument then test is required to "Exit true (0) if $1 is not null;
otherwise, exit false."  Since "--help" is not null then test will
exit true (0) for that expression.

See the standards page for more information.



reply via email to

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