From: git Date: Mon, 16 Feb 2026 09:50:10 +0000 (-0500) Subject: small optimization for "tohex" X-Git-Url: https://git.datadissipation.net/?a=commitdiff_plain;h=1fb2e344d2c53fd041b223381c89ae498784c7cd;p=baseconv.git small optimization for "tohex" --- diff --git a/tohex b/tohex index 0452e91..733d07a 100755 --- a/tohex +++ b/tohex @@ -6,15 +6,13 @@ conv() { if [ "$m" -eq 0 ]; then printf "Decimal %s → Hex: " "$1" fi - printf "%s" "$p" - printf "%X\n" "$1" + printf "%s%X\n" "$p" "$1" elif printf "%s" "$1" | grep -qE '^0b[0-1]+$'; then if [ "$m" -eq 0 ]; then printf "Binary %s → Hex: " "$1" fi - printf "%s" "$p" - printf "%X\n" "$1" + printf "%s%X\n" "$p" "$1" else printf "Error: '%s' is not a valid binary or decimal number\n" "$1" >&2