diff options
author | Kevin Mandura <webmaster@kevin-mandura.de> | 2024-03-23 20:46:31 +0100 |
---|---|---|
committer | Kevin Mandura <webmaster@kevin-mandura.de> | 2024-03-23 20:46:31 +0100 |
commit | b4ba3139d898b212d5cc7c6f9cb2f4b00b2c07c4 (patch) | |
tree | a5d824ca5da93cc9d79eb7ffdaaa330e30abf7ff | |
parent | 73fff14f270052a41bee81c2599ffcb14bb22609 (diff) | |
download | dwm-status-sh-b4ba3139d898b212d5cc7c6f9cb2f4b00b2c07c4.tar.gz dwm-status-sh-b4ba3139d898b212d5cc7c6f9cb2f4b00b2c07c4.zip |
Ensure POSIX compliance
-rw-r--r-- | dwm-status.sh | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/dwm-status.sh b/dwm-status.sh index 2cfca67..9f3533e 100644 --- a/dwm-status.sh +++ b/dwm-status.sh @@ -280,10 +280,10 @@ module_cpu_temperature() { module_cpu_usage() { if [ "$1" = "force" ]; then # Get current CPU usage and store to file. - read cpu a b c prev_idle rest < /proc/stat + read -r cpu a b c prev_idle rest < /proc/stat prev_total=$((a+b+c+prev_idle)) sleep 0.5 - read cpu a b c idle rest < /proc/stat + read -r cpu a b c idle rest < /proc/stat total=$((a+b+c+idle)) cpu_usage=$((100*( (total-prev_total) - (idle-prev_idle) ) / (total-prev_total) )) cpu_usage="${cpu_usage}%" @@ -320,7 +320,7 @@ module_ram_usage() { module_audio_master_volume() { # Abort, if the amixer command is not installed. - if ! amixer &> /dev/null + if ! amixer 2>/dev/null 1>&2 then return fi @@ -389,7 +389,9 @@ module_battery() { battery_capacity=$(cat "${CONFIG_POWER_SUPPLIES_DIR}/${line}/capacity") total_battery_capacity=$(( total_battery_capacity+battery_capacity )) - done <<< "$battery_dirs" + done <<EOF +$battery_dirs +EOF battery_status="${battery_charging}${total_battery_capacity}%" |