small optimization for "tohex"
authorgit <redacted>
Mon, 16 Feb 2026 09:50:10 +0000 (04:50 -0500)
committergit <redacted>
Mon, 16 Feb 2026 09:50:10 +0000 (04:50 -0500)
tohex

diff --git a/tohex b/tohex
index 0452e918641250aa7c4d8b65c7757f4a3676a260..733d07aeff02dbc032897b4dded9752455af3bdd 100755 (executable)
--- 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