diff --git a/Tools/astyle/check_code_style.sh b/Tools/astyle/check_code_style.sh
index ddf89e601e6e2af8ffdcaa96db9b642642eb32c8..24ee4565dc1a684dc43c936f2e72567702966a76 100755
--- a/Tools/astyle/check_code_style.sh
+++ b/Tools/astyle/check_code_style.sh
@@ -4,8 +4,8 @@ FILE=$1
 DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
 
 if [ -f "$FILE" ]; then
-	${DIR}/fix_code_style.sh --dry-run $FILE | grep --quiet Formatted
-	if [[ $? -eq 0 ]]; then
+	CHECK_FAILED=$(${DIR}/fix_code_style.sh --dry-run --formatted $FILE)
+	if [[ $CHECK_FAILED ]]; then
 		${DIR}/fix_code_style.sh --quiet < $FILE > $FILE.pretty
 
 		echo