From 920283041b8753167d7c82f1e869450012bee1da Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchuk Date: Fri, 11 Oct 2024 13:06:10 +0300 Subject: [PATCH] Add files via upload Signed-off-by: Mykhailo Kravchuk --- smartmon.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/smartmon.sh b/smartmon.sh index c20a850..51fdc83 100755 --- a/smartmon.sh +++ b/smartmon.sh @@ -166,13 +166,12 @@ format_output() { awk -F'{' "${output_format_awk}" } -smartctl_version="$(/usr/sbin/smartctl -V | head -n1 | awk '$1 == "smartctl" {print $2}')" +smartctl_version="$(/usr/sbin/smartctl -V | awk 'NR==1 && $1 == "smartctl" {print $2}')" echo "smartctl_version{version=\"${smartctl_version}\"} 1" | format_output -if [[ "$(expr "${smartctl_version}" : '\([0-9]*\)\..*')" -lt 6 ]]; then - exit -fi +# Exit if "smartctl" version is lower 6 +[[ ${smartctl_version%.*} -lt 6 ]] && exit 0 device_list="$(/usr/sbin/smartctl --scan-open | awk '/^\/dev/{print $1 "|" $3}')"