From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18760 invoked by alias); 13 Mar 2014 14:54:35 -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: 18604 Received: (qmail 19546 invoked from network); 13 Mar 2014 14:54:28 -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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1394722094; bh=fThlIMFdyLBZ5x6gTJhN8Gi4RSgpxIXpjNDl/iUylKI=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=jV4CZncNCPrk8F8R3yPVrWuxBTvNy9q/S+Kxc35eekKhsS9PVfF4pcdY8CtwevpVd/2B9ZMb1Sxo1tWTU/8SdJ41qxoaQvw0uDTKMNfKyy0rNWiuouUlPoQVKg4Y8XlEQNC6ciBX2QXuVrkBWFgy9d98LPmxxIWHAYcktWVde8Q= X-Yahoo-Newman-Id: 458709.66287.bm@smtp114.mail.sg3.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: KpnK9uQVM1mYCW_tQd.2CdM_ZfsOCs_yOZpkdoDBN8SJm6C wxj_dS7BpzgPST_oQN3StlyocwZd8exQSNCTFrcs97rh9ptYtlyh7Qg.64lG SxaG7V1s2x0fkffasx4zRIWTaiujEQyhQ2EgZqp6.E3DN_bC8AYrAtMxfIAK d_l4XFpeGMq0DL2K4BOeyG7PojFsBIb6weNWlq7YJ2uJZtDoVXGQXht4_E4N sQ7whEMxdzmj20XXt_aLlw6Mr6.0pT_ECK1WHfw9gLl4dg8H8b.Sa0Bb8a5B wavMJwsPdvr_8i4RJ5Xl0HXh744fffk3MICcnLJzJYvErxy0_AcoNYWW_q0g Le7ZtopKNC.i3RtbxrJcfgM_tHW8mk9kgQtqw7IcMzqW1jW2upyWTCFJ43ur sD00iQubnD_urN.7ol745o0zB28RxR3xvlE9WS0hjRO2ryZwHdTXBMNjEwMM LuXD_GX_rvM2cHcbNhtN7b1x8B8s63dRBmu9M1ZyApdV9GdMaXsA4xb8hHsg bfRMy0CbvESTlinvzATGS X-Yahoo-SMTP: JFuGfEmswBAJxZtns.VSD4UvEHQ- X-Rocket-Received: from localhost.localdomain (ammdispose-zsh@59.182.187.254 with plain [106.10.150.171]) by smtp114.mail.sg3.yahoo.com with SMTP; 13 Mar 2014 07:48:14 -0700 PDT Message-ID: <5321C52D.7030104@yahoo.com> Date: Thu, 13 Mar 2014 20:18:13 +0530 From: Amm User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: zsh-users@zsh.org Subject: Re: noglob does not call alias? References: <1394700750.34719.YahooMailNeo@web194603.mail.sg3.yahoo.com> <197551394709878@web5h.yandex.ru> <20140313123811.GH26446@localhost.mi.fu-berlin.de> In-Reply-To: <20140313123811.GH26446@localhost.mi.fu-berlin.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 03/13/2014 06:08 PM, Christoph (Stucki) von Stuckrad wrote: >>> $ noglob rm 1 > 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. This I think is wrong. noglob and nocorrect should be treated as special case and word following should be checked for existence of alias. (not just command) >>> How do I prevent this? > To prevent 'this', you need to make the > Option '-i' permanent for all 'rm' calls, > which is easier in functions, see at end. Hmm, then I think functions should be recommended instead of alias atleast for risky commands like 'rm; >>> Also 'noglob' does not respect RM_STAR_SILENT=off. >>> >>> $ unsetopt RM_STAR_SILENT >>> $ rm * >>> >>> zsh: sure you want to delete all the files in ... [yn]? n >>> rm: missing operand >>> Try `rm --help' for more information. > Well, it DID ask! Umm, this was not a question. This was part of example. I was just showing what happens without noglob. > BUT you still had your alias defined, so you really called > > noglob rm -i * > As already pointed above noglob does not call rm with -i Probably you mean nocorrect instead of noglob. >>> First I think when I said 'n'(no), it should not call >>> 'rm' at all instead of calling it without any filename. > THIS is an interesting question! > 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? This actually was side question unrelated to this thread. >>> But, anyway, continuing with my e-mail: Here comes the question. >>> $ noglob rm * >>> rm: cannot remove `*': No such file or directory > This is, as it should be, and must not reply > differently, lest being incompatible to the > reaction of the other shell variants. I know, I already stated that this does not cause any harm. But what I meant that I would still prefer zsh to trigger a warning whether I used noglob OR not. I NEVER do 'rm *'. So if there is rm * on command line that surely means, its by mistake, so I would prefer to see a warning, even if there is 'noglob'. > Such 'strange' effects made me switch completely > from using 'aliases' to 'functions' instead! Yep, even I think I should switch to 'functions'! But I would again propose that 'noglob' and 'nocorrect' should not treat next word as command, it should also check for alias. Thanks for your replies Amm