quotes prevent glob and word splitting + spelling

This commit is contained in:
Elias Howell 2023-01-02 13:59:13 -05:00
parent 345f4e678e
commit 19ad8e5fb4
5 changed files with 16 additions and 16 deletions

16
bar.sh
View file

@ -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

2
config
View file

@ -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=" "

View file

@ -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=' '

View file

@ -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

View file

@ -1,6 +1,6 @@
#!/bin/bash
# Prints out your public IP adress
# Prints out your public IP address
# Depends on curl
PREFIX=' '