Re: Docco

2024-03-27 Thread Chet Ramey
On 3/27/24 7:40 AM, Andreas Schwab wrote: The check for whether the first argument is '!' is not performed, because the "$2 is a binary primary" check comes first. This is how POSIX documents it. FWIW, ksh parses it the other way round: $ ksh93 -c '[ ! -a /tmp ]; echo $?; [ . -a /tmp ]; echo

Re: Docco

2024-03-27 Thread Chet Ramey
On 3/27/24 5:50 AM, Phi Debian wrote: Ok may be my wording is not correct, but yet it require a good reading compile to get it right, first read all about [[ that is at the top of the man (at 5%), then get the 'CONDITIONAL EXPRESSIONS' distingo between [[ vs [ (at 40%) and finally get to 'test e

Re: Docco

2024-03-27 Thread Chet Ramey
On 3/27/24 5:00 AM, Phi Debian wrote: $ man bash ... CONDITIONAL EXPRESSIONS ... -a file True if file exists. -e file True if file exists. ... 'May be' would be nice for newbies to precise which options are [ specific vs [[ specific for instance A

Re: Docco

2024-03-27 Thread Andreas Schwab
On Mär 27 2024, Greg Wooledge wrote: >> $ [ ! -a /tmp ] && echo ok || echo nok >> ok > > Here, you have three arguments, and argument 2 is a "binary primary" > (POSIX wording again), so it's treated as if you had written this: > > [ ! ] && [ /tmp ] && echo ok || echo nok > > This is simply per

Re: Docco

2024-03-27 Thread Greg Wooledge
On Wed, Mar 27, 2024 at 10:00:06AM +0100, Phi Debian wrote: > $ man bash > ... > CONDITIONAL EXPRESSIONS > ... > >-a file > True if file exists. >-e file > True if file exists. > ... > > 'May be' would be nice for newbies to precise which options are [

Re: Docco

2024-03-27 Thread Phi Debian
Interestingly, the ksh docco say that 'Conditional Expressions' applies to [[ only :-) and then say the -a is obsolete. test expression later says the -a and -o binary oper- ators can be used, but they are fraught with pitfalls due to grammatical ambiguities a

Re: Docco

2024-03-27 Thread Phi Debian
On Wed, Mar 27, 2024 at 10:28 AM Andreas Kähäri wrote: > On Wed, Mar 27, 2024 at 10:00:06AM +0100, Phi Debian wrote: > > $ man bash > > Would it not be untrue to say that "-a" is specific to "[[", as it is > clearly not the case? The fact that it is easy to confuse the two is > a different matte

Re: Docco

2024-03-27 Thread Andreas Kähäri
On Wed, Mar 27, 2024 at 10:00:06AM +0100, Phi Debian wrote: > $ man bash > ... > CONDITIONAL EXPRESSIONS > ... > >-a file > True if file exists. >-e file > True if file exists. > ... > > 'May be' would be nice for newbies to precise which options are [