[v2] dim: use grep -q instead of grep|wc

Submitted by Jani Nikula on March 21, 2017, 11:12 a.m.

Details

Message ID 1490094751-1613-1-git-send-email-jani.nikula@intel.com
State New
Headers show
Series "dim: shellcheck v0.4.4 fixes" ( rev: 2 ) in Intel GFX

Not browsing as part of any series.

Commit Message

Jani Nikula March 21, 2017, 11:12 a.m.
Fix shellcheck SC2126: Consider using grep -c instead of grep|wc.

We can use -q as suggested by Daniel because we don't care about the
exact count.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 Makefile | 1 -
 dim      | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/Makefile b/Makefile
index 139fd82ba441..1f628e9489f9 100644
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,6 @@  SC_EXCLUDE := \
 	-e SC2086 \
 	-e SC2119 \
 	-e SC2120 \
-	-e SC2126 \
 	-e SC2143
 
 shellcheck:
diff --git a/dim b/dim
index d961bb493616..33b393d3f27a 100755
--- a/dim
+++ b/dim
@@ -502,7 +502,7 @@  function dim_rebuild_tip
 	rerere=$DIM_PREFIX/drm-rerere
 
 	cd $rerere
-	if [[ $(git status --porcelain | grep -v "^[ ?][ ?]" | wc -l) -gt 0 ]]; then
+	if git status --porcelain | grep -q -v "^[ ?][ ?]"; then
 		warn_or_fail "integration configuration file $integration_config not commited"
 	fi