From 3e2cc9833787598ad3cb1c72b9a3741f67a3c6f0 Mon Sep 17 00:00:00 2001 From: dtb Date: Tue, 23 Aug 2022 11:40:00 -0400 Subject: [PATCH] various fixes --- bin/battery | 10 +++++++++- bin/data | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/bin/battery b/bin/battery index 93ed99c..17eb0bc 100755 --- a/bin/battery +++ b/bin/battery @@ -1,5 +1,13 @@ #!/bin/sh +subprogram="$(command -v "$0")" +if ! nonzero "$subprogram" && ! test -e "$0"; then + printf "%s: can't find myself!\n" "$0" + exit 70 # sysexits(3) EX_SOFTWARE +else + subprogram="$0" +fi + # battery -> battery.linux battery.netbsd etc subprogram="$0"."$(uname | lowercase)" @@ -8,4 +16,4 @@ if ! command -v "$subprogram" >/dev/null 2>&1 && ! test -e "$subprogram"; then exit 70 # sysexits(3) EX_SOFTWARE fi -"$subprogram" | exit 70 # sysexits(3) EX_SOFTWARE +"$subprogram" || exit 70 # sysexits(3) EX_SOFTWARE diff --git a/bin/data b/bin/data index c64c756..98cf4f5 100755 --- a/bin/data +++ b/bin/data @@ -11,7 +11,7 @@ CPU_TEMP_FILES="/sys/devices/platform/coretemp.0/hwmon/hwmon4/temp2_input CPU_TEMP_SCALE=1000 # format for the date (by default in this script, ISO 8601) -DATE="date '+%Y-%m-%dT%T'" +DATE="date +%Y-%m-%dT%T" DELIMITER=" || " @@ -88,7 +88,7 @@ PUBLIC_IP="$(get_public_ip)" printbar() { printf "%b" "$(get_current_desktop)" - printf "%b" $("$DATE") + printf "%b" $($DATE) printf "%b" "$DELIMITER" printf "%b" "BAT: $(battery)" printf "%b" "$DELIMITER"