From: Chris Koeritz Date: Thu, 8 Sep 2016 01:00:07 +0000 (-0400) Subject: updated to include more file types, plus better escaping to avoid matching files... X-Git-Tag: 2.140.90~463 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=813c826d5d37cc01f9db83c27439e4dd3a721806;p=feisty_meow.git updated to include more file types, plus better escaping to avoid matching files in current dir rather than specified dir. --- diff --git a/scripts/buildor/buildor_count_code.sh b/scripts/buildor/buildor_count_code.sh index 2d8c894e..c80b6f81 100644 --- a/scripts/buildor/buildor_count_code.sh +++ b/scripts/buildor/buildor_count_code.sh @@ -2,12 +2,13 @@ TOTALS=0 -codefile_list=(.c .cpp .h .java .pl .py .sh) +codefile_list=(.c .cpp .h .java .pl .py .sh .wsdl .gwsdl .xml .properties .config .configuration .txt makefile\* ) + for ((i=0 ; i < ${#codefile_list[@]}; i++)); do if [ ! -z "$phrases" ]; then phrases="$phrases -o" fi - phrases="$phrases -iname *${codefile_list[i]}" + phrases="$phrases -iname \*${codefile_list[i]}" done #echo phrases is now $phrases @@ -15,20 +16,18 @@ while true; do export NAME_LIST_TEMP_FILE="$(mktemp "$TMP/zz_code_count.XXXXXX")" dir="$1"; shift - if [ -z "$dir" ]; then break; fi - #echo dir is $dir -#set -o xtrace -##hmmm: how to turn off tracing thing? - - find "$dir" -type f $phrases >$NAME_LIST_TEMP_FILE + # for some reason we had to add an eval in front to get this + # working after escaping the asterisk (so as not to include + # local files that matched the patterns). + eval find "$dir" -type f $phrases >$NAME_LIST_TEMP_FILE #echo ==================================================== -#echo file holds these matches: +#echo file $NAME_LIST_TEMP_FILE holds these matches: #cat $NAME_LIST_TEMP_FILE #echo ====================================================