Hmmmm.  I sat on that blasted committee.

I'll file a corrigendum or whatever it's called.  This should at
least be called out in the rationale.

No biggie.  I'll just make sure I quote all of my args.

ccb


> Charlie Bennett wrote:
>> Is this expected behavior?
>>
>> [EMAIL PROTECTED] .ssh]# [ -f  ]
>> [EMAIL PROTECTED] .ssh]# echo $?
>> 0
>
> Yes.  That is expected behavior.  With one argument the return code is
> true if the string is non-zero in length.  The case covered is this
> case:
>
>   if [ "$variable" ]; then
>     echo variable contains data
>   fi
>
> Because you can enter any data you want into variable if it were
> interpreted as a -f operator then you would get the dreaded "test:
> argument expected" message as was often seen before this rule came
> into place.  POSIX requires this behavior.  See this document:
>
>   http://www.opengroup.org/onlinepubs/009695399/utilities/test.html
>
> The pertinent lines are:
>
>   0 arguments:
>       Exit false (1).
>   1 argument:
>       Exit true (0) if $1 is not null; otherwise, exit false.
>   2 arguments: ...
>
> Bob
>
>



_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to