From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19072 invoked by alias); 7 Dec 2015 11:24:03 -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: 21058 Received: (qmail 17670 invoked from network); 7 Dec 2015 11:24:00 -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-AuditID: cbfec7f5-f79b16d000005389-f8-56656c4d29d7 Date: Mon, 07 Dec 2015 11:23:54 +0000 From: Peter Stephenson To: Zsh Users Subject: Re: Filtering argument lists (e.g. for grep) Message-id: <20151207112354.5d24de89@pwslap01u.europe.root.pri> In-reply-to: <20151207105622.GA18231@linux.vnet.ibm.com> References: <20151207105622.GA18231@linux.vnet.ibm.com> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrALMWRmVeSWpSXmKPExsVy+t/xK7q+OalhBl0PhCx2nFzJ6MDoserg B6YAxigum5TUnMyy1CJ9uwSujIeTXjEWNHNUrF52hqWBcSJbFyMnh4SAicS/h+/YIWwxiQv3 1gPFuTiEBJYySmzsWsEI4Uxjkli85AcrhHOaUeLmhy9QzhlGiTuPjrCC9LMIqEpc6DvBBGKz CRhKTN00mxHEFhFQlDjz6xtYXFjAVGLDh1Ng9bwC9hLHV+wEi3MKWEgsOnAFaDcH0FBziQvP DUHC/AL6Elf/fmKCOM9eYuaVM4wQrYISPybfYwGxmQW0JDZva2KFsOUlNq95ywxiCwmoS9y4 u5t9AqPwLCQts5C0zELSsoCReRWjaGppckFxUnqukV5xYm5xaV66XnJ+7iZGSDh/3cG49JjV IUYBDkYlHt4JmSlhQqyJZcWVuYcYJTiYlUR4ZTNTw4R4UxIrq1KL8uOLSnNSiw8xSnOwKInz ztz1PkRIID2xJDU7NbUgtQgmy8TBKdXAeGzaRWXbG585Yg6b37i7nf9thctBVoHZapx/bRbL 8ev9L7qbvcefKbyg86XOFwOdAwZdHO/d+za6bF0U7pHBMiWfpe9GSuoKZc5pJ1wXz5/VFHfJ 4fE3iwm3l08Q2/yvJjKfW+TqmlUXiq7blU8Qn38n9Y1ztU2EMuOECUcLPT8aXeL64Fcio8RS nJFoqMVcVJwIAFBuXGFjAgAA On Mon, 7 Dec 2015 11:56:22 +0100 Dominik Vogt wrote: > For some commands, there are some file patterns that I never want > to pass to the command (unless explicitly stated otherwise). For > example, grep'ing should normally ignore backup and ChangeLog files > > *ChangeLog* > *~ > \#* > > 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)' Ig you want that first * to be something more flexible you can use a glob qualifier. gi () { [[ $REPLY != (*\~|\#*|ChangeLog) ]] } and use *(+gi) pws