Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: noglob does not call alias?
On 03/13/2014 08:06 PM, Bart Schaefer wrote:
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 ?
This works if alias rm='rm -i'
but gives error if I have these:
alias rm='nocorrect rm -i'
alias noglob='noglob '
$ noglob rm 1
zsh: command not found: nocorrect
As I already said in my previous e-mail that, zsh needs to consider
noglob and nocommand as special case and treat the next argument as
alias as well as command. (not just command)
Then we will not need the workarounds like create a rm() function or
create alias noglob='noglob '
} 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.
Asking 3 times make no sense!
I think purpose of this 'rm *' special handling is to prevent accidental
file deletion. (due to accidental addition of * in arguments)
So if he typed: rm * 1 2 3
And then zsh warns me and then I said "Oh, no I dont want this! And
answe no".
It obvious I made a mistake, So rm should NOT be executed at all (even
if there are arguments remaining)
Let him first manually delete '*' from command and execute rm again.
Amm
Messages sorted by:
Reverse Date,
Date,
Thread,
Author