diff --git a/system-info/system-info-Linux.sh b/system-info/system-info-Linux.sh index 62e22fc..024e0b5 100755 --- a/system-info/system-info-Linux.sh +++ b/system-info/system-info-Linux.sh @@ -8,21 +8,27 @@ if [ ! -d $cache_dir ]; then mkdir -p $cache_dir fi -if sensors 'coretemp-isa-0000' &> /dev/null; then - function get_cpu_temp() { - sensors 'coretemp-isa-0000' | awk 'NR == 3 { print substr($4, 2) }' - } -elif sensors 'k10temp-pci-00c3' &> /dev/null; then - function get_cpu_temp { - sensors 'k10temp-pci-00c3' | grep 'Tctl:' | awk '{ print $2 }' - } +if command -v sensors &> /dev/null; then + if sensors 'coretemp-isa-0000' &> /dev/null; then + function get_cpu_temp() { + sensors 'coretemp-isa-0000' | awk 'NR == 3 { print substr($4, 2) }' + } + elif sensors 'k10temp-pci-00c3' &> /dev/null; then + function get_cpu_temp { + sensors 'k10temp-pci-00c3' | grep 'Tctl:' | awk '{ print $2 }' + } + else + function get_cpu_temp { + echo '' + } + fi else function get_cpu_temp { echo 'N/A°C' } fi -if [ "`acpi -b`" != "No support for device type: power_supply" ]; then +if [[ "$(acpi -b 2>&1 /dev/null)" != "No support for device type: power_supply" ]]; then function get_battery { local output=$(acpi -b) local charging=$(echo $output | awk '{ print $3 }')