From cd451491ff2a5fbd371e3403a5abab6a7e9fd22d Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Fri, 3 Aug 2018 00:14:49 +0000 Subject: [PATCH] find-unused-css: Fix shellcheck warnings. In tools/find-unused-css line 5: if [ $(git grep "$n" | grep -v '^static/styles/zulip.css' | wc -l) -eq 0 ]; then ^-- SC2046: Quote this to prevent word splitting. ^-- SC2126: Consider using grep -c instead of grep|wc -l. In tools/find-unused-css line 6: echo $n ^-- SC2086: Double quote to prevent globbing and word splitting. Signed-off-by: Anders Kaseorg --- tools/find-unused-css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/find-unused-css b/tools/find-unused-css index 86c5b771f7..d474922c03 100755 --- a/tools/find-unused-css +++ b/tools/find-unused-css @@ -2,7 +2,7 @@ # Hackish tool for attempting to find unused IDs / classes in our CSS for n in $(perl -lne 'print $1 while /[#.]([a-zA-Z0-9_-]+)/g' static/styles/zulip.css | sort -u); do - if [ $(git grep "$n" | grep -v '^static/styles/zulip.css' | wc -l) -eq 0 ]; then - echo $n + if [ "$(git grep "$n" | grep -cv '^static/styles/zulip.css')" -eq 0 ]; then + echo "$n" fi done