From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: noglob does not call alias?
Date: Thu, 13 Mar 2014 07:36:41 -0700 [thread overview]
Message-ID: <140313073641.ZM14350@torch.brasslantern.com> (raw)
In-Reply-To: <20140313123811.GH26446@localhost.mi.fu-berlin.de>
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
next prev parent reply other threads:[~2014-03-13 14:37 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
2014-03-13 12:38 ` Christoph (Stucki) von Stuckrad
2014-03-13 13:36 ` ZyX
2014-03-13 14:36 ` Bart Schaefer [this message]
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=140313073641.ZM14350@torch.brasslantern.com \
--to=schaefer@brasslantern.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).