Search code examples
functionshellzshzsh-completion

Weird function declaration (or is it?) in zsh


I tried to find certain files by filename creation in zsh (although I read the manpage multiple times I did not really now what I was doing), but I think something went terribly wrong:

After I typed echo 10-02-2015.*(), I was prompted to type something — zsh put out function>. I randomly typed in n, and pressed enter.

But after that, every command I execute appends “echo:16: command not found: n”, which seems like I defined a function with an empty function name, but I do not see how that makes sense.

With that in mind: What the heck happened here, and how can I revert it?


Solution

  • Some quick poking at zsh seems to indicate that the first bit of echo:16: command not found: n is the command that failed (and the number is the prompt number of the session or something?).

    So, somehow, it would seem that whatever you did redefined echo as a shell function that is attempting to call n (which obviously doesn't exist).

    I suspect that type -f echo will confirm this and that echo "foo" will not work correctly at the moment.

    You should be able to simply start a new zsh session to "fix" the problem.

    Alternatively, unset -f echo appears to work as well.