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: Greg Wooledge
Subject: Re: extension of file-test primitives?
Date: Mon, 21 Aug 2017 09:27:13 -0400
User-agent: NeoMutt/20170113 (1.7.2)

On Sat, Aug 19, 2017 at 05:30:34PM -0700, 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 && ...

You could write your own helper functions for this:

-fx() { test -f "$1" && test -x "$1"; }

if -fx /bin/ls; then ...; fi



reply via email to

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