Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to detect which version of the find command is used from a shell script. GNU find supports the --version argument but the find command on OSX apparently does not support that. Is there a way to detect which version it is?

share|improve this question

2 Answers 2

up vote 2 down vote accepted
$ strings `which find`|grep find.c

sorry, can't find a nicer way than that. but I believe you should just check the OS version, not the individual program.

share|improve this answer
    
very creative :) –  Fabian Jakobs Jun 5 '12 at 18:05

You cannot. Since you didn't explain more about why you need it, I can only suggest at this point that it would be wise to just use the features of find that are specified by the POSIX standard. It's easy to distinguish GNU find vs BSD find (the one that comes with MacOS X) by just trying the --version parameter.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.