On 2007-08-22 15:29:55 +0200, Vincent Lefevre wrote:
> Also, the case with 5 or more arguments is not clear either.
> In fact, I don't know if this is a bug (due to a primitive parser)
> or a bad documentation.
It seems to be a bug, since a similar problem occurs with 4 arguments,
which case is specified by POSIX:
[EMAIL PROTECTED]:~$ [ \( ! -e \) ] && echo OK
bash: [: `)' expected, found ]
POSIX says: "However, when using the "[...]" form, the right-bracket
final argument shall not be counted in this algorithm."
So, we are in the 4-argument case: ( ! -e )
POSIX says in this case: "If $1 is '(' and $4 is ')', perform the
two-argument test of $2 and $3."
i.e. this is equivalent to: test ! -e
POSIX says in this 2-argument case: "If $1 is '!', exit true if $2 is
null, false if $2 is not null."
So, that's perfectly valid, and the error returned by bash is a bug.
--
Vincent Lefèvre <[EMAIL PROTECTED]> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)