c57c6fce1da12de4e71a89f6c9f7075893811c13
[feisty_meow.git] / scripts / buildor / find_in_code.sh
1 #!/bin/bash
2 seek="$1"; shift
3 if [ -z "$seek" ]; then
4   echo This script needs a pattern to look for in the current directory.
5   echo All code files here and in subdirectories will be searched for the
6   echo pattern.
7   exit 1
8 fi
9 #hmmm: might be nice to support multiple directories...
10 #      just need to pass them to find as an array maybe?
11 dir="$1"; shift
12 if [ -z "$dir" ]; then
13   dir=.
14 fi
15
16 find "$dir" -type f \( -iname "*" \
17   ! -iname "*.class" \
18   ! -iname "*.dll" \
19   ! -iname "*.exe" \
20   ! -iname "entries" \
21   ! -iname "*.git" \
22   ! -iname "*.gz" \
23   ! -iname "*.jar" \
24   ! -iname "*.lib" \
25   ! -iname "*.obj" \
26   ! -iname "*.svn" \
27   ! -iname "*.svn-base" \
28   ! -iname "*.tar" \
29   ! -iname "*.tmp" \
30   ! -iname "*.zip" \) \
31   -exec echo "\"{}\"" ';' | xargs grep -li "$seek"