Created
February 26, 2025 09:11
-
-
Save santaklouse/f53da3180c4e29d7f675d1ebad8ccf8f to your computer and use it in GitHub Desktop.
hex to string bash function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# echo 68656c6c6f20776f726c64|hex2string -> hello world | |
function hex2string(){ | |
i=${1:-$(</dev/stdin)}; | |
spaced=$(echo "$i"|fold -w2); | |
for i in ${spaced[@]}; do | |
echo -n -e "\x$i"; | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment