[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 17:59:39 -0400 |
On Aug 13, 2014, at 2:31 PM, Ken Irving <ken.irving@alaska.edu> wrote:
> I like the idea, but switch negation would need to be supported, and
> I don't think that's been covered sufficiently. Using ! as a switch
> modifier might be possible, and I like it, but would then also apply to
> single filetest switches, e.g., -!e foo would be the same as ! -e foo.
> Maybe that's possible, but it seems a fairly major addition to the syntax.
Agree on all.
> I'm a little confused about the 'before' example:
>
> if [[ -d foo ]] && [[ -r foo ]] && [[ -x foo ]] ; then . . .
>
> I thought that && could be used reliably within the [[ ]] construct,
> including short-circuiting the tests, so this could be:
>
> if [[ -d foo && -r foo && -x foo ]] ; then . . .
>
> I don't see how the bundled switces could be ambiguous, so must be
> missing something.
Both forms work, which I didn't expect. Learn something new every day; thanks.