Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make the "find" Command on OS X default to the current directory?

I am a heavy command line user and use the find command extensively in my build system scripts. However on Mac OS X when I am not concentrating I often get output like this:

$ find -name \*.plist
find: illegal option -- n
find: illegal option -- a
find: illegal option -- m
find: illegal option -- e
find: *.plist: No such file or directory

Basically, I forgot to add the little dot:

$ find . -name \*.plist

Because BSD find requires the path and GNU find doesn't (it assumes the current directory if you don't specify one). I use Linux, Mac OS X and Cygwin often all at the same time, so it's of great benefit to me to have all my tools behave the same. I tried writing a bash find function that added "./" if I forgot, but I failed. Thanks for your help. :)

like image 913
mxcl Avatar asked Oct 11 '08 22:10

mxcl


1 Answers

Install GNU find instead.

$ brew install findutils
$ alias find=gfind

Yay, it works!

like image 117
odinho - Velmont Avatar answered Sep 17 '22 16:09

odinho - Velmont