Reading this article I realized I always put `find .`, i.e. explicitly specifying the current directory. I guess this is like saying `ls .` all the time, but oh well.
Sometimes I find that I need to chain a few actions for my search results that aren't possible with multiple -execs, so I employ the shell script loop:
for js in `find . -name '*.js'`; do
dir=`dirname $js`;
cd $dir && make;
java -jar jsmin.jar "$i";
done;
Unfortunately if you've got spaces in your filenames, this will throw off /bin/sh and you have to specify delimiters or work around that.
Lastly, I've found with find that if you have a n-sized conditional where n > 1 and an -exec, you'll want to use escaped parentheses or otherwise the conditionals won't evaluate properly.
Sometimes I find that I need to chain a few actions for my search results that aren't possible with multiple -execs, so I employ the shell script loop:
Unfortunately if you've got spaces in your filenames, this will throw off /bin/sh and you have to specify delimiters or work around that.Lastly, I've found with find that if you have a n-sized conditional where n > 1 and an -exec, you'll want to use escaped parentheses or otherwise the conditionals won't evaluate properly.
Edits: addressing formatting woes.