diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2017-10-11 15:25:37 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2017-10-11 15:25:37 +0200 |
commit | f4c7c9332f6572b84bda52de7fb3d6fcab33e5bf (patch) | |
tree | c5b363f71394aafe74bea9d81490c81d74ad2abf | |
parent | feb46495ebba27980fd234ef0fe09ee88f87723c (diff) | |
download | bin-f4c7c9332f6572b84bda52de7fb3d6fcab33e5bf.zip bin-f4c7c9332f6572b84bda52de7fb3d6fcab33e5bf.tar.gz |
check_java_packages : use sed instead of grep
-rwxr-xr-x | check_java_packages | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/check_java_packages b/check_java_packages index d12f4fb..fcc9e4f 100755 --- a/check_java_packages +++ b/check_java_packages @@ -13,17 +13,17 @@ RED="\033[0;31m" BROWN="\033[0;33m" GREEN="\033[0;32m" -find $TOPDIR -name *.java | while read file; +find $TOPDIR -name \*.java | while read file; do relpath=${file#${TOPDIR}} CORRECT=$(echo $relpath | sed 's/\.\///; s/\/\+/\./g; s/\.\w\+.java//') - N=$(cat $file | grep package | wc -l) + N=$(cat $file | sed -n '/^\s*package /p ' | wc -l) if [ $N -gt 1 ]; then echo -e "$file : $BROWN more then 1 package directive$RESET"; touch $ERRORS continue fi - PACKAGE=$(cat $file | grep package) + PACKAGE=$(cat $file | sed -n '/^\s*package /p ') if [ -z "$PACKAGE" ]; then echo -e "$file : $BROWN missing package directive$RESET"; touch $ERRORS |