aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zed
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/zed')
-rwxr-xr-xcmd/zed/zed.d/io-spare.sh7
1 files changed, 4 insertions, 3 deletions
diff --git a/cmd/zed/zed.d/io-spare.sh b/cmd/zed/zed.d/io-spare.sh
index dd5bf4e0f..894817317 100755
--- a/cmd/zed/zed.d/io-spare.sh
+++ b/cmd/zed/zed.d/io-spare.sh
@@ -54,10 +54,11 @@ flock -x 8
# Given a <pool> and <device> return the status, (ONLINE, FAULTED, etc...).
vdev_status() {
local POOL=$1
- local VDEV=`basename $2`
+ local VDEV=$2
+ local T=' ' # tab character since '\t' isn't portable
- ${ZPOOL} status ${POOL} | \
- awk -v pat="${VDEV}|${VDEV/-part?}" '$0 ~ pat { print $1" "$2 }'
+ ${ZPOOL} status ${POOL} | sed -n -e \
+ "s,^[ $T]*\(.*$VDEV\(-part[0-9]\+\)\?\)[ $T]*\([A-Z]\+\).*,\1 \3,p"
return 0
}