From 3d0954b205e8657328ff5d55e17754b84497f4c2 Mon Sep 17 00:00:00 2001 From: Thanh Ha Date: Tue, 7 Mar 2017 10:36:02 -0500 Subject: [PATCH] Simplify find loop in check-unicode script grep prints out a list of problematic lines anyway so we don't need to echo our own statement. This removes an unnecessary find loop and only uses grep. Change-Id: I7580c80620d8808b54ee9df57b2c1290ad73e26b Signed-off-by: Thanh Ha --- scripts/check-unicode.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/scripts/check-unicode.sh b/scripts/check-unicode.sh index ab20a3ec3..931c99fac 100755 --- a/scripts/check-unicode.sh +++ b/scripts/check-unicode.sh @@ -16,12 +16,10 @@ directory=${1:-"."} echo "Scanning $directory" -while IFS= read -r -d '' x -do - if LC_ALL=C grep -q '[^[:print:][:space:]]' "$x"; then - echo "file $x contains non-ascii characters" - exit 1 - fi -done < <(find "$directory" -type f -print0) +if LC_ALL=C grep -r '[^[:print:][:space:]]' "$directory"; then + echo "Found files containing non-ascii characters." + exit 1 +fi echo "All files are ASCII only" + -- 2.36.6