From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27430 invoked by alias); 7 May 2014 15:04:23 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 18785 Received: (qmail 28118 invoked from network); 7 May 2014 15:04:16 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <140507080347.ZM13744@torch.brasslantern.com> Date: Wed, 07 May 2014 08:03:47 -0700 In-reply-to: <20140507124101.GA53652@isis.sigpipe.cz> Comments: In reply to Roman Neuhauser "globbing in conditional expressions" (May 7, 2:41pm) References: <20140507124101.GA53652@isis.sigpipe.cz> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: globbing in conditional expressions MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On May 7, 2:41pm, Roman Neuhauser wrote: } } i was hoping i could combine conditional expressions with } some globbing, but i'm struggling to find the proper syntax. Conditional expressions only do pattern matching against strings, they do not do globbing against file names. So glob qualifiers like (/F) have no special meaning in a conditional expression. The way to handle this is to perform the glob first and then test the result of globbing, e.g. if function { set - foobar(/FN) && [[ -z $1 ]] } then print not a directory or empty else print directory contains files fi Use a subshell if the version of zsh is old enough not to support anonymous functions.