From 19ad8e5fb4c8b0cfa44038a62f84443b1488107d Mon Sep 17 00:00:00 2001 From: Elias Howell Date: Mon, 2 Jan 2023 13:59:13 -0500 Subject: [PATCH] quotes prevent glob and word splitting + spelling --- bar.sh | 16 ++++++++-------- config | 2 +- modules/disksize | 2 +- modules/networkdowntraffic | 10 +++++----- modules/publicip | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/bar.sh b/bar.sh index a600381..f396834 100755 --- a/bar.sh +++ b/bar.sh @@ -20,7 +20,7 @@ else OUTPUT_CACHE="/home/$USER/.config/dwmbar/.cache/" fi -source $CONFIG_FILE +source "$CONFIG_FILE" OUTPUT="" @@ -28,7 +28,7 @@ get_bar() { for module in $MODULES; do if [[ $INTERNET -eq 0 ]] || [[ $ONLINE_MODULES != *"$module"* ]];then - module_out="$(cat $OUTPUT_CACHE$module | sed 's/\.$//g')" + module_out="$(cat "$OUTPUT_CACHE""$module" | sed 's/\.$//g')" bar="$bar$module_out" fi done @@ -41,9 +41,9 @@ run_module() { if [[ -f "$CUSTOM_DIR$1" ]] then - out="$($CUSTOM_DIR$1)" + out="$("$CUSTOM_DIR""$1")" else - out="$($DEFAULT_MODULES_DIR$1)" + out="$("$DEFAULT_MODULES_DIR""$1")" fi if [[ "$out" = " " ]]; then @@ -58,17 +58,17 @@ run() { for module in $MODULES; do [[ ! -f "$OUTPUT_CACHE$module" ]] && touch "$OUTPUT_CACHE$module" - pgrep $module &> /dev/null + pgrep "$module" &> /dev/null notrunning=$([[ $? -eq 1 ]]) if $notrunning && [[ $INTERNET -eq 0 ]]; then - run_module $module + run_module "$module" elif $notrunning && [[ $INTERNET -eq 1 ]]; then - [[ "$ONLINE_MODULES" != *"$module"* ]] && run_module $module + [[ "$ONLINE_MODULES" != *"$module"* ]] && run_module "$module" fi done get_bar - sleep $DELAY; + sleep "$DELAY"; } run diff --git a/config b/config index 969dbcf..118d85a 100644 --- a/config +++ b/config @@ -15,6 +15,6 @@ CUSTOM_DIR="/home/$USER/.config/dwmbar/modules/custom/" # Separator between modules SEPARATOR=" | " -# Padding at the end and beggining of the status bar +# Padding at the end and beginning of the status bar RIGHT_PADDING=" " LEFT_PADDING=" " diff --git a/modules/disksize b/modules/disksize index babd950..1582cc0 100755 --- a/modules/disksize +++ b/modules/disksize @@ -1,6 +1,6 @@ #!/bin/bash -# Prints out the total disk memory and the availeable memory +# Prints out the total disk memory and the available memory PREFIX=' ' diff --git a/modules/networkdowntraffic b/modules/networkdowntraffic index e8d3a74..76e8d8d 100755 --- a/modules/networkdowntraffic +++ b/modules/networkdowntraffic @@ -6,13 +6,13 @@ PREFIX=' ' get_down_traffic() { - RECIEVE1=0 - RECIEVE2=0 + RECEIVE1=0 + RECEIVE2=0 IFACES=$(ip -o link show | awk -F': ' '{print $2}') for IFACE in $IFACES; do if [ $IFACE != "lo" ]; then - RECIEVE1=$(($(ip -s -c link show $IFACE | tail -n3 | head -n 1 | cut -d " " -f5) + $RECIEVE1)) + RECEIVE1=$(($(ip -s -c link show $IFACE | tail -n3 | head -n 1 | cut -d " " -f5) + $RECEIVE1)) fi done @@ -21,11 +21,11 @@ get_down_traffic() IFACES=$(ip -o link show | awk -F': ' '{print $2}') for IFACE in $IFACES; do if [ $IFACE != "lo" ]; then - RECIEVE2=$(($(ip -s -c link show $IFACE | tail -n3 | head -n 1 | cut -d " " -f5) + $RECIEVE2)) + RECEIVE2=$(($(ip -s -c link show $IFACE | tail -n3 | head -n 1 | cut -d " " -f5) + $RECEIVE2)) fi done - echo "$PREFIX$(expr $(expr $RECIEVE2 - $RECIEVE1 ) / 1000)KB/s" + echo "$PREFIX$(expr $(expr $RECEIVE2 - $RECEIVE1 ) / 1000)KB/s" } get_down_traffic diff --git a/modules/publicip b/modules/publicip index 2e94e04..bdcb6a1 100755 --- a/modules/publicip +++ b/modules/publicip @@ -1,6 +1,6 @@ #!/bin/bash -# Prints out your public IP adress +# Prints out your public IP address # Depends on curl PREFIX=' '