diff --git a/do-clang-format.sh b/do-clang-format.sh
index ebfcb2322063638db155308dfb1c5d45272324f9..816ef19bdb0646f8d1de7ac9703fa8ccb156adfe 100755
--- a/do-clang-format.sh
+++ b/do-clang-format.sh
@@ -4,7 +4,12 @@ command="clang-format -style=file `find . -iregex '^.*\.\(cc\|h\)$' -not -path '
 
 if [ "$1" == "check" ];
 then
-    ! ${command}  -output-replacements-xml | grep -c "<replacement " 
-else
+    `! ${command}  -output-replacements-xml | grep -qc "<replacement "` || \
+        { echo "format-check FAILED!"; exit $ERRCODE; }
+    echo "Congratulations: format-check succeeded"
+elif [ "$1" == "apply" ];
+then
     ${command} -i
+else
+    echo "please use: ./do-clang-format.sh [check] or [apply]"
 fi