Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Safety guards for typos



On 1/24/22, Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx> wrote:
> So I just had a rather bad time when I didn't type a dot.
>
> Instead of:
>
>     mv *(.) old-2022-01-23/
>
> I typed:
>
>     mv *() old-2021-01-24/
>
> This created a function `mv` and a function for each entry in the
> current directory.  I should not have had a directory named `cd`, that
> was a bad call.  My Downloads area is full of cruft.
>
> Is there anything that I can turn on, in parsing, so that *() is
> interpreted as a syntax error instead of doing the globbing first and
> then defining many functions?

setopt NO_MULTI_FUNC_DEF would probably do the trick in this case,
though it will also prevent explicitly saying mv cp ln() { whatever }.

-- 
Mikael Magnusson




Messages sorted by: Reverse Date, Date, Thread, Author