From: ZyX <kp-pav@yandex.ru>
To: Amm <ammdispose-zsh@yahoo.com>
Cc: zsh-users@zsh.org
Subject: Re: noglob does not call alias?
Date: Thu, 13 Mar 2014 15:24:38 +0400 [thread overview]
Message-ID: <197551394709878@web5h.yandex.ru> (raw)
In-Reply-To: <1394700750.34719.YahooMailNeo@web194603.mail.sg3.yahoo.com>
13.03.14, 13:01, "Amm" <ammdispose-zsh@yahoo.com>":
>
> 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
next prev parent reply other threads:[~2014-03-13 11:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-13 8:52 Amm
2014-03-13 11:24 ` ZyX [this message]
2014-03-13 12:38 ` Christoph (Stucki) von Stuckrad
2014-03-13 13:36 ` ZyX
2014-03-13 14:36 ` Bart Schaefer
2014-03-13 15:17 ` Amm
2014-03-13 17:02 ` Bart Schaefer
2014-03-13 14:48 ` Amm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=197551394709878@web5h.yandex.ru \
--to=kp-pav@yandex.ru \
--cc=ammdispose-zsh@yahoo.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).