We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 18fcb1c + 9202830 commit c10a458Copy full SHA for c10a458
smartmon.sh
@@ -166,13 +166,12 @@ format_output() {
166
awk -F'{' "${output_format_awk}"
167
}
168
169
-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}')"
170
171
echo "smartctl_version{version=\"${smartctl_version}\"} 1" | format_output
172
173
-if [[ "$(expr "${smartctl_version}" : '\([0-9]*\)\..*')" -lt 6 ]]; then
174
- exit
175
-fi
+# Exit if "smartctl" version is lower 6
+[[ ${smartctl_version%.*} -lt 6 ]] && exit 0
176
177
device_list="$(/usr/sbin/smartctl --scan-open | awk '/^\/dev/{print $1 "|" $3}')"
178
0 commit comments