levye
levye

Reputation: 552

grep command sometimes won't work on mac os x

I'm getting this error sometimes. Same user, same bash profile, same export but sometimes return commend not found.

bash-3.2# find . | grep httpd.conf
bash:  grep: command not found

Upvotes: 2

Views: 3310

Answers (1)

levye
levye

Reputation: 552

This is actually a common but subtle problem. Depending on keyboard layout, you may use the alt key to create a | pipe.

If you accidentally hold down alt for too long, and hit alt+space together, you'll get what looks to a human like a space after the pipe, but is not the same character. alt+space is a non-breaking space (like   in HTML).

Make sure when you type a | pipe, that you have fully released the alt key before pressing space. Then the terminal will correctly recognise the grep command.

Upvotes: 3

Related Questions