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

zsh function declaration bug



Hello,

I noticed some interesting behavior when declaring zsh functions without
specifying the `function` keyword. When I declare a function that is a
prefix of some other item in my path or another alias, the function that is
a prefix is called instead.  For example:

------------
(macbook) ➜ mgild $ zsh --version
zsh 5.3 (x86_64-apple-darwin17.0)
(macbook) ➜ mgild $ ls
Applications/ Desktop/      Documents/    Downloads/    Library/
Movies/       Music/        Pictures/     Public/
(macbook) ➜ mgild $ l(){echo "hello"}
(macbook) ➜ mgild $ ls
hello
(macbook) ➜ mgild $
-------------- (zsh 5.5 exhibits different behavior)
➜ mgild $ zsh --version
zsh 5.5 (x86_64-debian-linux-gnu)
➜ mgild $ ls
Desktop Documents
➜ mgild $ l(){ echo "hello"}
zsh: defining function based on alias `ls'
zsh: parse error near `()'
--------------
zsh 5.5 seems to exhibit different behavior, but it is still unexpectedly
failing to create the function.

Let me know if any more information is required.

Thank you.

Mitchell Gildenberg
mgild@xxxxxxxxxx


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