From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25302 invoked by alias); 7 Dec 2015 11:49:53 -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: 21060 Received: (qmail 23617 invoked from network); 7 Dec 2015 11:49:52 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-IBM-Helo: d06dlp03.portsmouth.uk.ibm.com X-IBM-MailFrom: vogt@linux.vnet.ibm.com X-IBM-RcptTo: zsh-users@zsh.org Date: Mon, 7 Dec 2015 12:39:41 +0100 From: Dominik Vogt To: Zsh Users Subject: Re: Filtering argument lists (e.g. for grep) Message-ID: <20151207113941.GA24545@linux.vnet.ibm.com> Reply-To: vogt@linux.vnet.ibm.com Mail-Followup-To: Zsh Users References: <20151207105622.GA18231@linux.vnet.ibm.com> <20151207112354.5d24de89@pwslap01u.europe.root.pri> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151207112354.5d24de89@pwslap01u.europe.root.pri> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15120711-0029-0000-0000-00000516854C On Mon, Dec 07, 2015 at 11:23:54AM +0000, Peter Stephenson wrote: > On Mon, 7 Dec 2015 11:56:22 +0100 > Dominik Vogt wrote: > > Maybe grep is a bad example because this can be done with the > > --exclude= option. But could zsh help filtering the names > > generated by globbing in a more general way so that I could write > > > > $ * > > > > and have zsh automagically filter the results of the * (not > > everywhere; only for commands that have this feature enabled) so > > that the non-matching names are not passed to the command in the > > first place? > You could use a global alias, e.g. > > alias -g '@*'='*~(*\~|\#*|ChangeLog)' Yes, but then I'd need an alias for every potential pattern, e.g. @*.s*, @**/*, @*.c.* etc. > Ig you want that first * to be something more flexible you can use a > glob qualifier. > > gi () { > [[ $REPLY != (*\~|\#*|ChangeLog) ]] > } > > and use > > *(+gi) That sounds good, but is there a way to make that qualifier a default for certain commands? As an alternative, is it possible to access the command name from inside the qualifier function? function gi () { if ; then [[ $REPLY != (*\~|\#*|ChangeLog) ]] fi } Ciao Dominik ^_^ ^_^ -- Dominik Vogt IBM Germany