bash: grep: command not found

It took me a year to understand why my grep was every so often not working:

[MBP]$ ps -ef | grep openidm
-bash: grep: command not found

The explanation lies in the fact that I was typing this a bit too fast. In fact when I was typing the “space” after the “pipe” (which on mac is shit+option+L), the option key was still pressed and I ended up typing option+space instead of space. And option+space is interpreted differently from space in the terminal. Got this hint from this thread: http://hintsforums.macworld.com/showthread.php?p=644491

On solution would be to carefully release the option key before pressing the space…. but a more convenient one can be found there:
http://earthwithsun.com/questions/78245/how-to-disable-the-option-space-key-combination-for-non-breaking-spaces
I choose the configuration of iTerm2:
“I use iTerm2 for most of my work and the mapping can be added in the “Keys” preference pane, by adding a new key combination in Preferences -> Keys -> the plus button. Note when adding the key make sure to put a single space in the lower box as shown.” => works great

Mystery explained and problem solved!

Leave a Reply

Your email address will not be published. Required fields are marked *