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

Re: Problem with user function



On Fri, Feb 23, 2024 at 8:26 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> This is basically a dead issue now, but trying it is exactly what I did:
>
>
> % alias X='echo howdy'; Y() { X }
> zsh: defining function based on alias `Y'
> zsh: parse error near `()'

Can you reproduce this by running the command within `zsh -f`? Recall
that `zsh -f` gives you a blank state: zsh with no rc files sourced.

> BTW, interesting that his problem was solved by adding 'function' -- I though that was always optional, but in this case the parser seems to care.

Non-global aliases are expanded only in command position, so adding
`function` in front of `ls()`  disables alias expansion of `ls` and
thus fixes the problem Duke was having.

Roman.




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