Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: if the file is not found the files is not found is the file not found



On 4 March 2012 20:44, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Mar 4,  7:48pm, Mikael Magnusson wrote:
>>
>> On 4 March 2012 19:37, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>> > I'm sure the archives of zsh-users hold many different answers to the
>> > question, "Given a file pattern, how do I test whether at least one
>> > matching file exists?"
>>
>> Here's one more for the collection,
>> if () { (( $# )) } arglblargh*(N[1]); then echo yes; else echo no; fi
>
> Yes, I was thinking about that but it doesn't capture the "is a plain
> file" semantics of [[ -f ]] -- which you can fix by adding qualifiers
> to the glob instead, of course -- and even my formulation falls down
> if the glob matches a mix of plain and not-plain files and the first
> one happens to be the wrong kind.
>
> (Also, the [1] in your formula is extraneous, but that's a nit.)

I like to imagine that it causes less data to be copied around. :)

-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author