From 07d6429c676d7fc9771bc45ac85c100bd33656b5 Mon Sep 17 00:00:00 2001 From: ZachIR Date: Sat, 9 Aug 2025 08:36:35 -0500 Subject: Fix power_now for batteries with no power_now file --- power_now | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'power_now') diff --git a/power_now b/power_now index 520310b..1fb31aa 100755 --- a/power_now +++ b/power_now @@ -26,9 +26,9 @@ case "$BATTERY" in fi elif [ -f "${DIRNAME}/current_now" ]; then if [ -n "${MILLIWATTS}" ]; then - POWER="$(cat "${DIRNAME}/current_now" "${DIRNAME}/voltage_now" | awk '{print $1*$2/1e9}' | head -1)" + POWER="$(cat "${DIRNAME}/current_now" "${DIRNAME}/voltage_now" | paste -d' ' -s | awk '{print $1*$2/1e9}' | head -1)" else - POWER="$(cat "${DIRNAME}/current_now" "${DIRNAME}/voltage_now" | awk '{print $1*$2/1e12}' | head -1)" + POWER="$(cat "${DIRNAME}/current_now" "${DIRNAME}/voltage_now" | paste -d' ' -s | awk '{print $1*$2/1e12}' | head -1)" fi fi if [ -n "${TOTAL}" ]; then @@ -68,9 +68,9 @@ case "$BATTERY" in fi elif [ -f "${DIRNAME}/current_now" ]; then if [ -n "${MILLIWATTS}" ]; then - POWER="$(cat "${DIRNAME}/current_now" "${DIRNAME}/voltage_now" | awk '{print $1*$2/1e9}' | head -1)" + POWER="$(cat "${DIRNAME}/current_now" "${DIRNAME}/voltage_now" | paste -d' ' -s | awk '{print $1*$2/1e9}' | head -1)" else - POWER="$(cat "${DIRNAME}/current_now" "${DIRNAME}/voltage_now" | awk '{print $1*$2/1e12}' | head -1)" + POWER="$(cat "${DIRNAME}/current_now" "${DIRNAME}/voltage_now" | paste -d' ' -s | awk '{print $1*$2/1e12}' | head -1)" fi fi if [ -z "${QUIET}" ]; then -- cgit v1.2.3