[Intel-gfx] [PATCH 2/8] dim: use [ p ] || [ q ] instead of test -a/-o

Jani Nikula jani.nikula at intel.com
Tue Mar 21 10:14:28 UTC 2017


Fix shellcheck SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well
defined.

Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
 dim | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dim b/dim
index c36ebdc7f7d8..eb0f0df85338 100755
--- a/dim
+++ b/dim
@@ -160,7 +160,7 @@ done
 shift $((OPTIND - 1))
 
 # first positional argument is the subcommand
-if [ -n "$HELP" -o "$#" = "0" ]; then
+if [ -n "$HELP" ] || [ "$#" = "0" ]; then
     subcommand="usage"
 else
     subcommand="$1"
@@ -178,7 +178,7 @@ if [[ -n "$__dim_running" ]]; then
 fi
 export __dim_running=1
 
-if [ "$subcommand" != "setup" -a "$subcommand" != "help" -a "$subcommand" != "usage" ]; then
+if [ "$subcommand" != "setup" ] && [ "$subcommand" != "help" ] && [ "$subcommand" != "usage" ]; then
 	for d in $DIM_PREFIX $DIM_PREFIX/$DIM_DRM_INTEL $DIM_PREFIX/drm-rerere $DIM_PREFIX/drm-tip; do
 		if [ ! -d $d ]; then
 			echo "$d is missing, please check your configuration and/or run dim setup"
-- 
2.1.4



More information about the Intel-gfx mailing list