From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6355 invoked from network); 6 Oct 2003 14:13:00 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 6 Oct 2003 14:13:00 -0000 Received: (qmail 11598 invoked by alias); 6 Oct 2003 14:12:42 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6650 Received: (qmail 11552 invoked from network); 6 Oct 2003 14:12:41 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 6 Oct 2003 14:12:41 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [216.27.138.216] by sunsite.dk (MessageWall 1.0.8) with SMTP; 6 Oct 2003 14:12:41 -0000 Received: from home.acholado.net (localhost.localdomain [127.0.0.1]) by home.acholado.net (8.12.8/8.12.8) with ESMTP id h96ECeWp014463 for ; Mon, 6 Oct 2003 10:12:40 -0400 Received: (from ljz@localhost) by home.acholado.net (8.12.8/8.12.8/Submit) id h96ECe5l014461; Mon, 6 Oct 2003 10:12:40 -0400 X-Authentication-Warning: home.acholado.net: ljz set sender to ljz@asfast.com using -f To: zsh-users@sunsite.dk Subject: Re: Something like noglob to inhibit brace expansion? References: <1031005162121.ZM2735@candle.brasslantern.com> From: Lloyd Zusman Reply-To: ljz@asfast.com Date: Mon, 06 Oct 2003 10:12:40 -0400 In-Reply-To: <1031005162121.ZM2735@candle.brasslantern.com> (Bart Schaefer's message of "Sun, 5 Oct 2003 16:21:21 +0000") Message-ID: User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: Lloyd Zusman Bart Schaefer writes: > On Oct 4, 7:40pm, Lloyd Zusman wrote: > } > } % pr {a,b,c,*} > } a b c * > } > } What I'd like to see is {a,b,c,*} > } > } Does anyone know of any tricks to get this functionality within > } an alias? > > It's a little ugly, but: > > alias pr='setopt noglob ignorebraces && _pr' > _pr() { print $*; setopt glob braceexpand } > > You can get a little fancier if you want to preserve the exit status of > 'print', but you get the idea. Aha! Thank you. And I think that the following will take care of the exit code: alias pr='setopt noglob ignorebraces && _pr' _pr() { print $*; local rc=$?; setopt glob braceexpand; return $rc } Hmm ... or what about this as an even uglier alternative (one long line in real life)? alias pr='eval "preexec() { setopt braceexpand; preexec(){} }" && setopt ignorebraces && noglob print' There's even probably some sort of way to make a generic alias or function for this, which can then be applied to any command to generate an alias for it without command-line expansion. Next time I have trouble sleeping at night, I'll work on that one. :) Feature suggestion: how about adding an 'ignorebraces' precommand modifier in a future version of zsh? Or perhaps even something which would pass in the completely unglobbed, unexpanded, un-everything'ed command line. Or even more radically, how about an 'ignore' precommand modifier which takes options that can be grouped together, such as -b for braces, -g for glob, -v for variable expansion, etc.? -- Lloyd Zusman ljz@asfast.com