bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: extension of file-test primitives?


From: Chet Ramey
Subject: Re: extension of file-test primitives?
Date: Mon, 21 Aug 2017 15:54:26 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

On 8/19/17 8:30 PM, L A Walsh wrote:
> Curious, but how difficult or problematic would it be
> to allow using brace-expansion (ex. {f,x} ) as a short-hand
> to test/combine file-op tests like:
> 
> Allowing:
> 
>   test -{f,x} /bin/ls && ...
> or
>    if [[ -{f,x} $file ]]; then ... ; fi
> 
> instead of:
> 
>   test -f /bin/ls && test -x /bin/ls && ...

In addition to changing the established meaning of brace expansion, this
would require that brace expansion understand the command word (test,
primarily) and change accordingly, and create an incompatibility between
the shell's builtin test and a test binary. That incompatibility would be
almost impossible to resolve.

If you want a new operator as syntactic sugar for composing expressions,
it would be better that it not resemble existing features.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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