Skip to content

Commit 9614bfd

Browse files
committed
Removed now unnecessary Bash 5.2.21 "printf" bug work-around.
1 parent e213183 commit 9614bfd

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

src/System-Info

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,6 @@ function print-system-information ()
111111
# Set the variables:
112112
eval "$(get-system-info)"
113113

114-
# ====== Work-around for messed up built-in printf in Bash 5.2 ===========
115-
# -> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1081424
116-
# -> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1078556
117-
local printf="printf"
118-
if [[ "${BASH_VERSION}" =~ ^5\.2\. ]] ; then
119-
printf="$(which printf || echo "printf")"
120-
fi
121-
122114
# ====== Obtain operating system information =============================
123115
DISTRIB_ID="$(gettext "Unknown")" # Unknown, yet.
124116
DISTRIB_RELEASE="${DISTRIB_ID}" # Unknown, yet.
@@ -164,15 +156,15 @@ function print-system-information ()
164156
# ------ Uptime ----------------------------------------------------------
165157
print-utf8 -i "${indent}" "$(gettext "Uptime:")"
166158
# shellcheck disable=SC2059
167-
${printf} "$(gettext "%s, %s, %s, and %s")\n" \
168-
"$(${printf} "$(ngettext "%'d day" "%'d days" "${uptime_days}")" "${uptime_days}")" \
169-
"$(${printf} "$(ngettext "%'d hour" "%'d hours" "${uptime_hours}")" "${uptime_hours}")" \
170-
"$(${printf} "$(ngettext "%'d minute" "%'d minutes" "${uptime_mins}")" "${uptime_mins}")" \
171-
"$(${printf} "$(ngettext "%'d second" "%'d seconds" "${uptime_secs}")" "${uptime_secs}")"
159+
printf "$(gettext "%s, %s, %s, and %s")\n" \
160+
"$(printf "$(ngettext "%'d day" "%'d days" "${uptime_days}")" "${uptime_days}")" \
161+
"$(printf "$(ngettext "%'d hour" "%'d hours" "${uptime_hours}")" "${uptime_hours}")" \
162+
"$(printf "$(ngettext "%'d minute" "%'d minutes" "${uptime_mins}")" "${uptime_mins}")" \
163+
"$(printf "$(ngettext "%'d second" "%'d seconds" "${uptime_secs}")" "${uptime_secs}")"
172164

173165
# ------ Operating System ------------------------------------------------
174166
print-utf8 -i "${indent}" "$(gettext "Operating System:")"
175-
${printf} "%s $(gettext "with kernel") %s\n" \
167+
printf "%s $(gettext "with kernel") %s\n" \
176168
"${os_label}" \
177169
"${system_release}"
178170

@@ -181,7 +173,7 @@ function print-system-information ()
181173
processesString="$(gettext "%'d processes")"
182174
usersString="$(ngettext "%'d user" "%'d users" "${system_users}")"
183175
# shellcheck disable=SC2059
184-
${printf} "$(gettext "%d × %s; ${processesString}; ${usersString}")\n" \
176+
printf "$(gettext "%d × %s; ${processesString}; ${usersString}")\n" \
185177
"${system_cores}" \
186178
"${system_machine}" \
187179
"${system_procs}" \
@@ -190,7 +182,7 @@ function print-system-information ()
190182
# ------ Load ------------------------------------------------------------
191183
print-utf8 -i "${indent}" "$(gettext "Load (1/5/15 min):")"
192184
# shellcheck disable=SC2059
193-
${printf} "$(gettext "%1.1f %% / %1.1f %% / %1.1f %%")\n" \
185+
printf "$(gettext "%1.1f %% / %1.1f %% / %1.1f %%")\n" \
194186
"${system_load_avg1min}" \
195187
"${system_load_avg5min}" \
196188
"${system_load_avg15min}"
@@ -244,7 +236,7 @@ function print-system-information ()
244236
fi
245237
capacity="${!capacityVariable}"
246238
# shellcheck disable=SC2059
247-
${printf} "${colorBattery}$(gettext "#%u %s, %u %%")${colorBasic}" \
239+
printf "${colorBattery}$(gettext "#%u %s, %u %%")${colorBasic}" \
248240
"${number}" \
249241
"${status}" \
250242
"${capacity}"
@@ -255,15 +247,15 @@ function print-system-information ()
255247
# ------ Memory ---------------------------------------------------------
256248
print-utf8 -i "${indent}" "$(gettext "Used Memory:")"
257249
# shellcheck disable=SC2059
258-
${printf} "$(gettext "%'6.0f MiB of %'6.0f MiB (%'6.0f MiB available: %'5.1f %%)")\n" \
250+
printf "$(gettext "%'6.0f MiB of %'6.0f MiB (%'6.0f MiB available: %'5.1f %%)")\n" \
259251
"$((system_mem_used / 1048576))" \
260252
"$((system_mem_total / 1048576))" \
261253
"$((system_mem_free / 1048576))" \
262254
"${system_mem_freepct}"
263255
if [ "${system_swap_total}" != "" ] && [ "${system_swap_total}" -gt 0 ] ; then
264256
print-utf8 -i "${indent}" "$(gettext "Used Swap:")"
265257
# shellcheck disable=SC2059
266-
${printf} "$(gettext "%'6.0f MiB of %'6.0f MiB (%'6.0f MiB available: %'5.1f %%)")\n" \
258+
printf "$(gettext "%'6.0f MiB of %'6.0f MiB (%'6.0f MiB available: %'5.1f %%)")\n" \
267259
"$((system_swap_used / 1048576))" \
268260
"$((system_swap_total / 1048576))" \
269261
"$((system_swap_free / 1048576))" \
@@ -298,7 +290,7 @@ function print-system-information ()
298290
colorDisk="${colorDiskNormal}"
299291
fi
300292
# shellcheck disable=SC2059
301-
${printf} "${colorDisk}$(gettext "%1.0f %% on %s")${colorBasic}" \
293+
printf "${colorDisk}$(gettext "%1.0f %% on %s")${colorBasic}" \
302294
"${!mountPointVariable}" \
303295
"${mountPoint}"
304296
fi

0 commit comments

Comments
 (0)