Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'm trying to set up a function to make certain grep command easier.

gr() { grep -r --include=*.\{m,h,xib\} $1 \* ; }

The end result should be a recursive grep of all *.m, *.h, and *.xib files, for whatever is specified by the command's argument:

$ gr SearchText

Can anyone demonstrate the correct syntax for this?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

Nevermind; thought I had tried everything I could imagine; turns out I was just over-zealous with escaping special characters from the shell. The syntax I was looking for is:

gr() { grep -r --include=*.{m,h,xib} "$1" * ; }
share|improve this answer
    
Make sure you accept your answer when you can. –  daviesgeek Oct 19 '11 at 18:29
add comment

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.