Skip to content

Commit

Permalink
memory,swap,diskspace: fix printf output for dashes
Browse files Browse the repository at this point in the history
  • Loading branch information
x70b1 committed Dec 15, 2023
1 parent 44510a4 commit 8d5f13e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions motd-on-acid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,17 @@ generate_bar() {
bar_used_color=$BAR_HEALTHY_COLOR
fi

printf ' %s \033[%sm%s\033[0m' "$1" "$bar_used_color" "$(printf "$BAR_ELEMENT"'%.0s' $(seq 1 $bar_used_size))"
printf ' %s \033[%sm%s\033[0m' "$1" "$bar_used_color" "$(printf -- "$BAR_ELEMENT"'%.0s' $(seq 1 $bar_used_size))"

if [ -n "$4" ]; then
bar_noticed_percent=$(( $4 * 100 / $2 ))
bar_noticed_size=$(( bar_width * bar_noticed_percent / 100 ))
bar_unused_size=$(( bar_width - bar_used_size - bar_noticed_size ))

printf '\033[1;36m%s\033[0m' "$(printf "$BAR_ELEMENT"'%.0s' $(seq 1 $bar_noticed_size))"
printf '\033[1;36m%s\033[0m' "$(printf -- "$BAR_ELEMENT"'%.0s' $(seq 1 $bar_noticed_size))"
fi

printf '\033[1;30m%s\033[0m\n' "$(printf "$BAR_ELEMENT"'%.0s' $(seq 1 $bar_unused_size))"
printf '\033[1;30m%s\033[0m\n' "$(printf -- "$BAR_ELEMENT"'%.0s' $(seq 1 $bar_unused_size))"
}

generate_bar_memory() {
Expand Down

0 comments on commit 8d5f13e

Please sign in to comment.