On 8/23/17 9:51 AM, Dethrophes wrote:

>>>> if testfile -fx file;then.
>>>
>>> Add the quotes, make opt local too, and I think we have a winner.
>> This has the advantage of supporting both syntax options: a single
>> option with multiple operators or a series of options, each with one
>> or more operators, combined with a single operand.
> 
> Not really as it changes the meaning of 
> test -f file -a -x file

It is not a drop-in replacement for test; it is syntactic sugar for
compound test operations. If you're concerned about this, add a test
before the loop to ensure that there are only two arguments to the function
and restrict it to that syntax option only.

> Which I always understood as the correct way of doing this in the first 
> place...

It's not as good as multiple test commands: test -f file && test -x file.
There's no ambiguity and you get short-circuiting.

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

Reply via email to