title: How to use '-prune' option of 'find' in sh?
body: <p>I don't quite understand the example given from the <code>man find</code>, can anyone give me some examples and explanations? Can I combine regular expression in it? </p>
  
  <hr>
  
  <p>The more detailed question is like this: </p>
  
  <p>Write a shell script, <code>changeall</code>, which has an interface like <code>changeall [-r|-R] "string1" "string2"</code>. It will find all files with an suffix of <code>.h</code>, <code>.C</code>, <code>.cc</code>, or <code>.cpp</code> and change all occurrences of <code>string1</code> to <code>string2</code>. <code>-r</code> is option for staying in current dir only or including subdir's.</p>
  
  <p>NOTE: </p>
  
  <ol>
  <li>For non-recursive case, <code>ls</code> is NOT allowed, we could only use <code>find</code> and <code>sed</code>.</li>
  <li>I tried <code>find -depth</code> but it was NOT supported. That's why I was wondering if <code>-prune</code> could help, but didn't understand the example from <code>man find</code>. </li>
  </ol>
  
  <hr>
  
  <p>EDIT2: I was doing assignment, I didn't ask question in great details because I would like to finish it myself. Since I already done it and hand it in, now I can state the whole question. Also, I managed to finish the assignment without using <code>-prune</code>, but would like to learn it anyway. </p>