Skip to content

Commit

Permalink
refactor: fix quoting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
d-Rickyy-b committed Jul 25, 2024
1 parent bee95e8 commit c411d5d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions 31-disktemp
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ COLUMNS=4
clear="\e[0m\e[39m"

my_target_temp=45
for i in ${!sd[@]}; do
temp=$(smartctl -a /dev/${sd[$i]} | grep Temperature_Celsius | grep 194 | awk '{print $10}' 2> /dev/null)
for i in "${!sd[@]}"; do
temp=$(smartctl -a "/dev/${sd[$i]}" | grep Temperature_Celsius | grep 194 | awk '{print $10}' 2> /dev/null)
color="\e[42m"
if [ "$temp" -ge "${my_target_temp}" ]; then
color="\e[41m"
fi
out+="${sd[$i]} \e[30m $color $temp°C $clear ,"
c=${i+1}
if [ $((($i+1) % $COLUMNS)) -eq 0 ]; then
if [ $(((i+1) % COLUMNS)) -eq 0 ]; then
out+="\n"
fi
done
out+="\n"
echo -e "
HDD Temps:"
printf "$out" | column -c $c -ts $',' | sed -e 's/^/ /'
printf "$out" | column -c "$c" -ts $',' | sed -e 's/^/ /'
2 changes: 1 addition & 1 deletion 50-fail2ban
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ for jail in "${jails[@]}"; do
bans=${bans:-0} # default value
unbans=${unbans:-0} # default value
diff=$((bans-unbans))
out+=$(printf "$jail, %+3s bans, %+3s unbans, %+3s active" "$bans" "$unbans" "$diff")"\n"
out+=$(printf "%s, %+3s bans, %+3s unbans, %+3s active" "$jail" "$bans" "$unbans" "$diff")"\n"
done

printf "\nfail2ban status (monthly):\n"
Expand Down
2 changes: 1 addition & 1 deletion 51-fail2ban_status
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ for jail in "${jails[@]}"; do
done

printf "\nfail2ban status:\n"
printf $out | column -ts $',' | sed -e 's/^/ /'
printf "$out" | column -ts $',' | sed -e 's/^/ /'

0 comments on commit c411d5d

Please sign in to comment.