0

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?

Lukas Juhrich
  • 395
  • 1
  • 4
  • 13
  • 1
    I'm going to assume this only affected your current shell and not all shells? Is simply closing that shell session and opening a new one not an option? What does `type -f echo` output? Does `echo "foo"` work correctly? – Etan Reisner Feb 16 '15 at 03:02
  • ah, it redefined echo to be a function trying to execute `n` — `type -f echo echo () { n }` As expected, `echo "foo"` does not work. `echo` generates two errors btw! – Lukas Juhrich Feb 16 '15 at 03:06
  • I'm not sure how that redefined `echo` but yeah that's what it looked like to me (after I poked at zsh for a minute). – Etan Reisner Feb 16 '15 at 03:07
  • Restarting zsh worked. You can go on and post that as an answer, I guess. – Lukas Juhrich Feb 16 '15 at 03:09

1 Answers1

1

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.

Etan Reisner
  • 77,877
  • 8
  • 106
  • 148