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