From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2243 invoked by alias); 22 Oct 2013 17:11:15 -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: 18044 Received: (qmail 2460 invoked from network); 22 Oct 2013 17:11:08 -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=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=V4wp+zHt5wZGKO4AdwUW6PoW6VX4TcsWijkJfglgONA=; b=RlIcQDy56TrfuuqddTfuQTg4aTteR2fgSaYfDyZSnn6UA3vL/fmOa1MMNVxepM5EjK Z4tl+SHFcJDhO+OPuZLv4BTGbWFkFnhdazwwWxSQPXRxHi0bUJ6WOexzF/FK7HyqcQHG mhl4QD2YHBGN5nPEF5fYzigmSAfBlWD3jQ4v0cfgbeFalp2HGQhP3f7S5mGSwrEvxV4G EaZ+XHJkPyIY9X1h078beTLI8sVK9XJOznIChxIY89+7/oAiaclEgrpvLU0uBBz8udQx X538dtS+ubqklF5jd3rfS3tMkoKU+GYMJVRza6ccRQSoy9/LG1Yj43nRicpyoqCTOsKq 9vNQ== X-Received: by 10.68.14.200 with SMTP id r8mr23936073pbc.52.1382461866218; Tue, 22 Oct 2013 10:11:06 -0700 (PDT) Date: Tue, 22 Oct 2013 11:11:02 -0600 From: Matt Garriott To: Brent Briggs Cc: zsh-users@zsh.org Subject: Re: Glob problem Message-ID: <20131022171102.GE22613@hazmatt> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) By default Zsh does not expand glob patterns in variables when using parameter expansion. You can change this behavior using the GLOB_SUBST option. Add the following line to the top of your script, and it should work like you expect. setopt GLOB_SUBST For more info check out GLOB_SUBST in `man zshoptions` -Matt On Tue, Oct 22, 2013 at 12:45:48PM -0400, Brent Briggs wrote: > Hello Zsh masters, > > I am simply trying to list all matches for a specified pattern in an array of directory paths, the $path array for example. Here is my attempt. Where am I going wrong? > > pattern=git* > for entry in $path > do > # Print all files in the path that match the pattern. > print $entry/$pattern > done > > Expected/Desired Output: > ------------------------ > /opt/local/bin/git > /opt/local/bin/git-credential-osxkeychain > /opt/local/bin/git-cvsserver > /opt/local/bin/git-receive-pack > /opt/local/bin/git-shell > /opt/local/bin/git-upload-archive > /opt/local/bin/git-upload-pack > /opt/local/bin/gitk > /usr/bin/git > /usr/bin/git-cvsserver > /usr/bin/git-receive-pack > /usr/bin/git-shell > /usr/bin/git-upload-archive > /usr/bin/git-upload-pack > > Actual Output: > ------------------- > /opt/local/bin/git* > /opt/local/sbin/git* > /opt/local/bin/git* > /opt/local/sbin/git* > /usr/bin/git* > /bin/git* > /usr/sbin/git* > /sbin/git* > /usr/local/bin/git* > /usr/local/MacGPG2/bin/git* > /Users/brent/bin/git* > /Users/brent/bin/git*