bug-bash
[Top][All Lists]
Advanced

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

Re: Feature request - ganged file test switches


From: Steve Simmons
Subject: Re: Feature request - ganged file test switches
Date: Wed, 13 Aug 2014 12:16:52 -0400

On Aug 12, 2014, at 4:36 PM, Chet Ramey <chet.ramey@case.edu> wrote:

> On 8/9/14, 7:07 AM, Steve Simmons wrote:
> 
>> It would be nice to have ganged file test switches. As an example, to test 
>> that a directory exists and is properly accessible one could do
>> 
>>  if [[ -d foo ]] && [[ -r foo ]] && [[ -x foo ]] ; then . . .
>> 
>> but
>> 
>>  if [[ -drx foo ]] ; then . . .
>> 
>> is a lot easier.
> 
> Sure, but it's only syntactic sugar.

Knew that going in :-). Other discussion points out how limited it is; I'm 
perfectly happy pulling back. My thoughts on how to do this more flexibly boil 
down to the capabilities gnu find has w/r/t file types and modes. Unfortunately 
we have a few systems which lack gnu find and are "vendor supported appliances" 
(eyeroll) and we're unable to add new software beyond simple scripts. Which 
also means that any new bash feature would probably be unavailable for years, 
so it's not like this is a big loss.

If others have no interest in this syntactic sugar I see little point to adding 
it; a broader and more flexible solution is just to use find as above.


reply via email to

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