Skip to content

Commit

Permalink
bashrc: temp - fix format (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
tenhishadow authored Dec 6, 2024
1 parent a22b21d commit 1046ec3
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions dotfiles/.bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,18 @@ function top() {
fi
}

# temperature
function temp() {
echo "Disks"
printf "dev\t\ttype\ttemp\tserial\t\t\t\t\tmodel\n"
for disk in /dev/sd[a-z] /dev/nvme[0-9]; do
[[ -c "$disk" ]] \
[[ -c "$disk" || -b "$disk" ]] \
&& sudo smartctl --all --json "$disk" \
| jq -r '"\(.device.info_name) \(.temperature.current)C \(.model_name) \(.serial_number)"'
| jq -r '
.device.name + "\t" +
.device.type + "\t" +
(.temperature.current | tostring) + "C\t" +
.serial_number + "\t\t\t" +
.model_name
'
done
}

Expand Down

0 comments on commit 1046ec3

Please sign in to comment.