#/bin/bash errorsh=0 errorsc=0 if [ -n "$1" ]; then # arguments given echo "With argument" $1 for file in $* ; do usingcheck $file if [ "$?" != "0" ]; then errorsc=$(expr $errorsc + 1) fi done else HFiles=$(find $PWD -iname "*.h" -o -iname "*.hpp") CFiles=$(find $PWD -iname "*.cpp") for file in $CFiles ; do usingcheck $file if [ "$?" != "0" ]; then errorsc=$(expr $errorsc + 1) fi done for file in $HFiles ; do usingcheck -header $file if [ "$?" != "0" ]; then errorsh=$(expr $errorsh + 1) fi done fi errors=$(expr $errorsh + $errorsc) if [ $errors != 0 ]; then echo "Using check failed" if [ $errorsh != 0 ]; then echo "there are $errorsh using commands in header files" fi if [ $errorsh != 0 ]; then echo "there are $errorsc includes after a using command" fi exit 1 fi echo using check successful