From 01ee5fba93c0cd4227d1b74fd10a8e8cc1ea5a92 Mon Sep 17 00:00:00 2001 From: Narvin Singh Date: Mon, 28 Dec 2020 13:58:09 -0500 Subject: [PATCH] Feat: Default suffix is percent sign By making the percent sign part of the suffix, it can be changed or entirely omitted by changing the suffix. --- module/bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/bat b/module/bat index a0de3d0..c43f5a8 100755 --- a/module/bat +++ b/module/bat @@ -6,7 +6,7 @@ mod_bat () { local -r DEFAULT_PRE_PLG=' ' local -r DEFAULT_PRE_UPLG=' ' local -r DEFAULT_PRE_UNK=' ' - local -r DEFAULT_SUF='' + local -r DEFAULT_SUF='%' local -r cnt="${1:-${DEFAULT_CNT}}" local -r pre_plg="${2-${DEFAULT_PRE_PLG}}" @@ -45,7 +45,7 @@ mod_bat () { # Get the current battery capacity read -r cap < "${cap_file}" - printf -v res '%b%3d%%%b' "${res}" "${cap}" "${suf}" + printf -v res '%b%3d%b' "${res}" "${cap}" "${suf}" done # In res, info for each battery is separated by a space, including a