diff --git a/bin/apricot-doctor b/bin/apricot-doctor index b4f5510..0f8fea1 100755 --- a/bin/apricot-doctor +++ b/bin/apricot-doctor @@ -88,8 +88,12 @@ cmd_check() { echo "NVMe composite temps:" for dev in /dev/nvme?n1; do [ -e "$dev" ] || continue + # Match exactly the "temperature" line (not "temperature_sensor_*"), + # then take the first integer after the colon. t=$(sudo -n nvme smart-log "$dev" 2>/dev/null \ - | awk -F: '/^temperature/ {gsub(/[^0-9.]/,"",$2); print $2; exit}') + | grep -E '^temperature[[:space:]]*:' \ + | head -1 \ + | sed -E 's/.*:[[:space:]]*([0-9]+).*/\1/') printf ' %s %s°C\n' "$dev" "${t:-?}" done fi @@ -116,7 +120,9 @@ cmd_check() { ok "no failed units" else warn "$failed_count failed unit(s):" - systemctl --failed --no-pager --no-legend | awk '{print " " $1}' + # --no-legend output: "● unit-name loaded failed failed Description" + # The first column is the bullet glyph; the unit name is $2. + systemctl --failed --no-pager --no-legend | awk '{print " " $2}' fi }