[Intel-gfx] [PATCH 7/8] dim: use grep -c instead of grep|wc

Daniel Vetter daniel at ffwll.ch
Tue Mar 21 10:41:43 UTC 2017


On Tue, Mar 21, 2017 at 12:14:33PM +0200, Jani Nikula wrote:
> Fix shellcheck SC2126: Consider using grep -c instead of grep|wc.
> 
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>
> ---
>  Makefile | 1 -
>  dim      | 2 +-
>  2 files changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index fe7e44ad69d9..78087f669221 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -28,7 +28,6 @@ SC_EXCLUDE := \
>  	-e SC2090 \
>  	-e SC2119 \
>  	-e SC2120 \
> -	-e SC2126 \
>  	-e SC2143
>  
>  shellcheck:
> diff --git a/dim b/dim
> index 16e489c0b508..53221de9171c 100755
> --- a/dim
> +++ b/dim
> @@ -496,7 +496,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 -c -v "^[ ?][ ?]") -gt 0 ]]; then

grep -q and drop the -gt 0?

>  		warn_or_fail "integration configuration file $integration_config not commited"
>  	fi
>  
> -- 
> 2.1.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list