summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2017-10-11 15:25:37 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2017-10-11 15:25:37 +0200
commitf4c7c9332f6572b84bda52de7fb3d6fcab33e5bf (patch)
treec5b363f71394aafe74bea9d81490c81d74ad2abf
parentfeb46495ebba27980fd234ef0fe09ee88f87723c (diff)
downloadbin-f4c7c9332f6572b84bda52de7fb3d6fcab33e5bf.zip
bin-f4c7c9332f6572b84bda52de7fb3d6fcab33e5bf.tar.gz
check_java_packages : use sed instead of grep
-rwxr-xr-xcheck_java_packages6
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