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
-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")
# Got a statechange for an individual VDEV
val=$(state_to_val "$ZEVENT_VDEV_STATE_STR")
vdev=$(basename "$ZEVENT_VDEV_PATH")
fi
guid=$(printf "%llu" "$1")
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
}
$ZPOOL get -H -ovalue,name guid | awk '$1=='"$guid"' {print $2}'
fi
}
-smartctl_path=$(which smartctl)
+smartctl_path=$(command -v smartctl)
if [ -b "$VDEV_UPATH" ] && [ -x "$smartctl_path" ] || [ -n "$samples" ] ; then
if [ -n "$samples" ] ; then
if [ -b "$VDEV_UPATH" ] && [ -x "$smartctl_path" ] || [ -n "$samples" ] ; then
if [ -n "$samples" ] ; then
esac
with_vals=$(echo "$out" | grep -E "$scripts")
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" |
echo "$with_vals"
without_vals=$(echo "$scripts" | tr "|" "\n" |
grep -v -E "$(echo "$with_vals" |
without_vals=$(echo "$scripts" | tr "|" "\n" | awk '{print $0"="}')
fi
without_vals=$(echo "$scripts" | tr "|" "\n" | awk '{print $0"="}')
fi
-if [ ! -z "$without_vals" ]; then
+if [ -n "$without_vals" ]; then
ZFS_URL="$REPO/zfs/tarball/$ZFS_TAG"
if [ "$TAG" = "installed" ]; then
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"
ZFS_SH="/usr/share/zfs/zfs.sh"
else
ZPOOL_CMD="./cmd/zpool/zpool"