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

Re: bug with aliases and declaring functions



On Aug 29,  6:08pm, Pete Fritchman wrote:
}
} So, my theory is that the zsh parser is
} re-writing 'foo() { echo func; }' to 'foo () { echo func; }' and then
} 'foo ' is seen at the beginning of the command, and foo's alias is
} substituted.

Yes, that's what's happening, as is explained in zsh FAQ #2.3, except
that it's a mistake to call it "re-writing."

The discussion of aliasing in the zsh manual says "Every token in the
shell input is checked ..." -- note that it says token, indicating that
aliasing is applied after lexical analysis, and that it specifically
does not say anything about requiring spaces to surround the token.



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