[Top][All Lists]

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

Re: extension of file-test primitives?

From: L A Walsh
Subject: Re: extension of file-test primitives?
Date: Tue, 22 Aug 2017 21:25:44 -0700
User-agent: Thunderbird

Chet Ramey wrote:
On 8/21/17 9:27 AM, Greg Wooledge wrote:
You could write your own helper functions for this:

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

This is indeed a quick and easy way to implement desired functionality.
Shell functions can do a lot.
   Alas, they don't work inside [[...]] with other
file-test operators:

[[ -fx /bin/ls && -s /bin/ls ]] && echo ok
-bash: conditional binary operator expected
-bash: syntax error near `/bin/ls'

reply via email to

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