From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16200 invoked by alias); 13 Mar 2014 14:37:00 -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: 18603 Received: (qmail 29270 invoked from network); 13 Mar 2014 14:36:54 -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: <140313073641.ZM14350@torch.brasslantern.com> Date: Thu, 13 Mar 2014 07:36:41 -0700 In-reply-to: <20140313123811.GH26446@localhost.mi.fu-berlin.de> Comments: In reply to "Christoph (Stucki) von Stuckrad" "Re: noglob does not call alias?" (Mar 13, 1:38pm) References: <1394700750.34719.YahooMailNeo@web194603.mail.sg3.yahoo.com> <197551394709878@web5h.yandex.ru> <20140313123811.GH26446@localhost.mi.fu-berlin.de> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: noglob does not call alias? MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Mar 13, 1:38pm, Christoph (Stucki) von Stuckrad wrote: } } aliases are expanded from the beginning of the LINE, } not from the command itself, so anything in front } of 'rm' seems to suppress the alias, like e.g. } FOO=bar rm 1 } also does. Umm, no. What gave you that idea? torch% alias rm='echo not removing' torch% FOO=bar rm 1 not removing 1 However, aliases defined without -g are only expanded in the command position (occupied by "noglob" in the original example) OR when the word in command position is itself an alias ending in a space. So the original complaint can be resolved by torch% alias noglob='noglob ' torch% noglob rm ? not removing ? } Why did 'rm *', resulting in 'noglob rm -i *' still execute ??? } } I assume, the handling of 'denied' case of 'rm *' ends with } a still existing parameter to 'rm', and thus runs the command } instead of ignoring it completely? That's correct. The handling for "rm *" actually walks through the argument list and asks once for every "*" or word ending in "/*" and if the answer is no, deletes it from the argument list and moves on to the next one. So "rm * * *" will prompt you three times. If arguments remain after that, the rm is executed. -- Barton E. Schaefer