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 [ specific
> vs [[ specific for instance
> 
>        -a file
>               True if file exists ([[ only, for [ see test builtin)
> 
> This to avoid things like
> 
> $ [   -a /tmp ] && echo ok || echo nok
> ok
> $ [ ! -a /tmp ] && echo ok || echo nok
> ok
> 
> I know it is obvious, unless this is intended to force a complete
> multi-pass man read...

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 matter, but the documentation is correct for the current
implementation (which mimics the ksh shell with regards to the unary
"-a" operator).

-- 
Andreas (Kusalananda) Kähäri
Uppsala, Sweden

.

Reply via email to