]> git.proxmox.com Git - mirror_zfs.git/commitdiff
shellcheck pass
authorbunder2015 <omfgbunder@gmail.com>
Mon, 4 Feb 2019 17:07:19 +0000 (12:07 -0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 4 Feb 2019 17:07:19 +0000 (09:07 -0800)
note: which is non-standard. Use builtin 'command -v' instead. [SC2230]
note: Use -n instead of ! -z. [SC2236]

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Giuseppe Di Natale <guss80@gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: bunder2015 <omfgbunder@gmail.com>
Closes #8367

cmd/zed/zed.d/statechange-led.sh
cmd/zed/zed.d/zed-functions.sh
cmd/zpool/zpool.d/smart
scripts/zimport.sh

index c1a1bd92d543a9386af2be2018152104906d7945..6484b79592aa53922f95e349cc80ba7dd931b07b 100755 (executable)
@@ -165,7 +165,7 @@ process_pool()
        fi
 }
 
-if [ ! -z "$ZEVENT_VDEV_ENC_SYSFS_PATH" ] && [ ! -z "$ZEVENT_VDEV_STATE_STR" ] ; then
+if [ -n "$ZEVENT_VDEV_ENC_SYSFS_PATH" ] && [ -n "$ZEVENT_VDEV_STATE_STR" ] ; then
        # Got a statechange for an individual VDEV
        val=$(state_to_val "$ZEVENT_VDEV_STATE_STR")
        vdev=$(basename "$ZEVENT_VDEV_PATH")
index fb16e9d36f3217be167dc7d1c6e71f49912b71b0..a6e608573e588cc62c47413045ac0c5795413686 100644 (file)
@@ -434,7 +434,7 @@ zed_guid_to_pool()
        fi
 
        guid=$(printf "%llu" "$1")
-       if [ ! -z "$guid" ] ; then
+       if [ -n "$guid" ] ; then
                $ZPOOL get -H -ovalue,name guid | awk '$1=='"$guid"' {print $2}'
        fi
 }
index 64b5f6e4e4bc1564c217b7eb11f5888695143242..bd18e9d0443c385c26c51a8f27b909a0d4854bb0 100755 (executable)
@@ -69,7 +69,7 @@ if [ "$1" = "-h" ] ; then
         exit
 fi
 
-smartctl_path=$(which smartctl)
+smartctl_path=$(command -v smartctl)
 
 if [ -b "$VDEV_UPATH" ] && [ -x "$smartctl_path" ] || [ -n "$samples" ] ; then
        if [ -n "$samples" ] ; then
@@ -228,7 +228,7 @@ smart_test)
 esac
 
 with_vals=$(echo "$out" | grep -E "$scripts")
-if [ ! -z "$with_vals" ]; then
+if [ -n "$with_vals" ]; then
        echo "$with_vals"
        without_vals=$(echo "$scripts" | tr "|" "\n" |
                grep -v -E "$(echo "$with_vals" |
@@ -237,6 +237,6 @@ else
        without_vals=$(echo "$scripts" | tr "|" "\n" | awk '{print $0"="}')
 fi
 
-if [ ! -z "$without_vals" ]; then
+if [ -n "$without_vals" ]; then
        echo "$without_vals"
 fi
index 426c329c9e1e32337b4332f8b34ce04225bbe17c..d7e82fe9f025ad9099cd52d809abd019e9d3c2be 100755 (executable)
@@ -233,8 +233,8 @@ src_set_vars() {
        ZFS_URL="$REPO/zfs/tarball/$ZFS_TAG"
 
        if [ "$TAG" = "installed" ]; then
-               ZPOOL_CMD=$(which zpool)
-               ZFS_CMD=$(which zfs)
+               ZPOOL_CMD=$(command -v zpool)
+               ZFS_CMD=$(command -v zfs)
                ZFS_SH="/usr/share/zfs/zfs.sh"
        else
                ZPOOL_CMD="./cmd/zpool/zpool"