Created
July 6, 2023 08:16
-
-
Save GregTonoski/08739025108aa3f5953a4312d0184a31 to your computer and use it in GitHub Desktop.
Display file content as hexadecimal string
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
#!/bin/bash | |
# file_as_hex.bash: display file content as hexadecimal string. | |
# Examples: | |
# $ bash file_as_hex.bash input_file.bin | |
export LC_ALL=C | |
exec 7< $1 | |
while IFS= read -n 1 -d '' -r -u 7; do | |
printf "%02X" "'$REPLY" | |
done | |
exec 7<&- | |
printf "\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment