diff --git a/tools/bits-info.sh b/tools/bits-info.sh index 3805c8c1..179ad9be 100755 --- a/tools/bits-info.sh +++ b/tools/bits-info.sh @@ -791,6 +791,11 @@ get_version() printf '%s\n' "${_version}" } +get_max_unsigned_int_of_shell_printf() +{ + printf '%u\n' '-1' +} + pause_if_needed() { # shellcheck disable=SC3028 # In POSIX sh, SHLVL is undefined @@ -813,10 +818,10 @@ main() _limits_date='32767 2147480047 2147483647 32535215999 32535244799 67767976233529199 67767976233532799 67768036191673199 67768036191676799 9223372036854775807' _limits_u='65535 2147483647 2147483648 4294967295 18446744073709551615' - shell_exe="$(get_shell_exe)" || : + shell_exe="$(get_shell_exe || :)" if test "$(uname 2> /dev/null -o || :)" = 'Msys' && command 1> /dev/null 2>&1 -v 'cygpath'; then shell_exe="$(cygpath -m -a -l -- "${shell_exe}" || :)"; fi - shell_info="$(get_shell_info "${shell_exe}")" || : - shell_name="$(printf '%s\n' "${shell_info}" | cut -d ' ' -f '1')" || : + shell_info="$(get_shell_info "${shell_exe}" || :)" + shell_name="$(printf '%s\n' "${shell_info}" | cut -d ' ' -f '1' || :)" printf '%s %s\n' "Shell:" "${shell_name}" if shell_applet="$(get_applet_name "${shell_name}")"; then @@ -903,14 +908,12 @@ main() done _shell_arithmetic_bit="$(convert_max_signed_int_to_bit "${_max}")" || _shell_arithmetic_bit='unknown' - { - # Some shells do NOT allow this, so we hide the errors - tmp_var="$(printf '%u\n' '-1')" || : - } 2> /dev/null - _shell_printf_bit="$(convert_max_unsigned_int_to_bit "${tmp_var}")" || : + # Some shells do NOT allow this, so we hide the errors + tmp_var="$(get_max_unsigned_int_of_shell_printf 2> /dev/null || :)" + _shell_printf_bit="$(convert_max_unsigned_int_to_bit "${tmp_var}" || :)" - tmp_var="$(awk -- 'BEGIN { printf "%u\n", "-1" }')" || : - _awk_printf_bit="$(convert_max_unsigned_int_to_bit "${tmp_var}")" || : + tmp_var="$(awk -- 'BEGIN { printf "%u\n", "-1" }' || :)" + _awk_printf_bit="$(convert_max_unsigned_int_to_bit "${tmp_var}" || :)" # IMPORTANT: For very big integer numbers GNU Awk may return the exponential notation or an imprecise number _max='-1'