Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: noglob does not call alias?
- X-seq: zsh-users 18600
- From: ZyX <kp-pav@xxxxxxxxx>
- To: Amm <ammdispose-zsh@xxxxxxxxx>
- Subject: Re: noglob does not call alias?
- Date: Thu, 13 Mar 2014 15:24:38 +0400
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1394709879; bh=NV5Xpi3daqgVMp9PNTBUsY+AIW9srCcZc6S0Um0SWJg=; h=From:To:Cc:In-Reply-To:Subject:Date; b=ZKHIAuUpOoaSbn9BlYUA0uvdbLTcUUcRaBW9ppJDqiXzbLgDz2JNCz4FLvt8eCy8l 7Tz72F/CM+SfLZqinKqS2HUABtSzCz7X5++Dw+BZVg6pHfhdj/JuHROClaIHNdhNCb xUXVhI3xXIsdSgV7efETPnKE83AWf4FzyyCal+ws=
- In-reply-to: <1394700750.34719.YahooMailNeo@web194603.mail.sg3.yahoo.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
13.03.14, 13:01, "Amm" <ammdispose-zsh@xxxxxxxxx>":
>
> Hello,
>
> So I was just trying this.
>
> $ alias rm='nocorrect rm -i'
> $ touch 1 2
>
> $ ls
> 1 2
>
>
> $ rm 1
> rm: remove regular empty file `1'? n
>
> $ noglob rm 1
>
> $ ls
> 2
>
>
> Shock!! File deleted without asking for confirmation?!
>
> I think this is not what (new zsh) user expects.
>
> How do I prevent this?
>
>
> 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.
>
> First I think when I said 'n'(no), it should not call
> 'rm' at all instead of calling it without any filename.
>
> But, anyway, continuing with my e-mail:
>
>
> $ noglob rm *
> rm: cannot remove `*': No such file or directory
>
>
>
> This caused no harm here but I would still prefer that
> it should ask if I am sure to delete all the files.
> (Purpose here is to warn user of scary error!)
I am not sure I understand correctly: do you say that "noglob rm *" should ask whether user wants to delete all files? It is not correct: due to the definition of "noglob" "noglob rm *" is "rm '*'": you ask do delete file named star, not to remove all files. Coreutils commands do not expand their arguments as it the job of the shell which in turn was told not to do this as well (noglob). Unless you use cygwin AFAIR.
>
>
>
> So any idea?
>
> Thanks in advance,
>
>
> Amm
Messages sorted by:
Reverse Date,
Date,
Thread,
Author