Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command not found after pipe

I'm using OS X Mavericks with zsh (technically the package oh-my-zsh).

I've been facing this bug for some time now and haven't found a way to fix it. Sometimes when I pipe a command it just says command not found.

For example, when I do a nmap network list scan like so nmap -sL 192.168.2.0/24 | grep ')' I sometimes get the error zsh: command not found:  grep. Even when I use arrow up button it won't work, so I have to rewrite the command, exactly the same, and it will work.

It is really annoying and it has happened occasionally with other commands and mostly after a pipe.

Any idea why this is occurring?

like image 972
Obi-Wan Avatar asked Jan 12 '16 12:01

Obi-Wan


1 Answers

The fact that it's happening only sometimes indicates that your input actually varies (subtly) from time to time.

It depends on what kind of keyboard you have, but I think it's likely that you're accidentally holding down the Alt key while you type the space after the pipe. Alt+Space is a non-breaking space, which zsh won't recognise.

like image 85
Stephan Avatar answered Sep 21 '22 13:09

Stephan