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

Re: odd recursion



William Scott wrote:


I hope you have your reasons to tell the shell "a is b" and "a is c"
at the same time. Basically your aliasing ls two times simultaneously.



The interesting thing is that if I issue

"which lf" it tells me that lf is aliased, not that it is defined as a function. If I then issue the newly defined lf command, the function takes precedence over the alias (which is what I understood to be the expected behavior), which I can see from the error messages produced.

The problem arose because a user made the alias without checking to see that the function was defined, and that the function was written as a posix function and defined after the alias in the sequence of shell initialization.

If the alias is defined after the posix function is defined, the problem doesn't arise.

I don't see any way around this, without taking away good and necessary behavior.

You can always use the really simple solution, which is not to have a name clash at all. I use a short script I wrote to tell me whether a name is already defined somewhere. It's got a bug in it w.r.t. functions (which makes it useless at the moment) but I'll (presumably) fix that.

IMHO, it is always better to keep things explicit rather than relying on the sequence of operations in the implementation.

A warning, as someone suggested, might be a better solution.



!DSPAM:41fe79f8244781930316049!




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