1
0

fix streq references

This commit is contained in:
dtb 2023-12-19 00:16:49 -07:00
parent 34a4c48a06
commit 3e77b69e66
4 changed files with 7 additions and 7 deletions

2
.gitignore vendored
View File

@ -6,6 +6,6 @@ nonzero/nonzero
roll/roll roll/roll
simexec/simexec simexec/simexec
str/str str/str
streq/streq strcmp/strcmp
sysexits/sysexits sysexits/sysexits
sysexits/sysexits.h sysexits/sysexits.h

View File

@ -18,7 +18,7 @@ date; printf "Current level: %d%%\n" "$current_level"
while true; do while true; do
current_level="$(battery)" current_level="$(battery)"
date; if ! streq "$current_level" "$previous_level"; then date; if ! strcmp "$current_level" "$previous_level"; then
printf '%s: %s%% -> %s%%\n' "$( printf '%s: %s%% -> %s%%\n' "$(
test "$current_level" -lt "$previous_level" \ test "$current_level" -lt "$previous_level" \
&& printf 'Discharged' \ && printf 'Discharged' \

View File

@ -20,7 +20,7 @@ DELIMITER=" || "
INTERVAL=1 INTERVAL=1
get_cpu_temp() { get_cpu_temp() {
if streq "$(uname)" "Linux"; then if strcmp "$(uname)" "Linux"; then
RETVAL="" RETVAL=""
# iterate over files, adjust, print out "%dC " # iterate over files, adjust, print out "%dC "
for file in $CPU_TEMP_FILES; for file in $CPU_TEMP_FILES;
@ -32,7 +32,7 @@ get_cpu_temp() {
printf "%b" "$RETVAL" \ printf "%b" "$RETVAL" \
| python -c "from sys import stdin; print(stdin.read().rstrip() + '\n')" | python -c "from sys import stdin; print(stdin.read().rstrip() + '\n')"
return return
elif streq "$(uname)" "NetBSD"; then elif strcmp "$(uname)" "NetBSD"; then
printf "%bC" "$(envstat -s coretemp0:'cpu0 temperature' \ printf "%bC" "$(envstat -s coretemp0:'cpu0 temperature' \
| sed 1,2d \ | sed 1,2d \
| cut -d ':' -f 2 \ | cut -d ':' -f 2 \
@ -59,7 +59,7 @@ get_current_desktop() {
} }
get_memory_usage() { get_memory_usage() {
if streq "$(uname)" "Linux"; then if strcmp "$(uname)" "Linux"; then
printf "%b" \ printf "%b" \
"$(free | head -n 2 | tail -n 1 \ "$(free | head -n 2 | tail -n 1 \
| awk '{print $3 " used / " $2 " total"}')" | awk '{print $3 " used / " $2 " total"}')"
@ -101,7 +101,7 @@ str isvalue "$CPU_TEMP_FILES" \
while true; do while true; do
printbar printbar
sleep "$INTERVAL" sleep "$INTERVAL"
if streq $(date +'%S') 00; then if strcmp $(date +'%S') 00; then
# every minute # every minute
PUBLIC_IP="$(ifpublic)" PUBLIC_IP="$(ifpublic)"
fi fi

View File

@ -15,7 +15,7 @@ argv0="$0"
VOLUME_TMP_FILE="$HOME/.volume-previous" VOLUME_TMP_FILE="$HOME/.volume-previous"
if streq "$(uname)" NetBSD; then if uname | xargs strcmp NetBSD; then
VOLUME_SYSTEM=netbsd VOLUME_SYSTEM=netbsd
elif command -v pactl >/dev/null 2>&1; then elif command -v pactl >/dev/null 2>&1; then
VOLUME_SYSTEM=pulseaudio VOLUME_SYSTEM=pulseaudio