Skip to content
Permalink
Browse files

updated text_to_hex.sh to use od

  • Loading branch information...
EvilRedHorse committed Jun 2, 2019
1 parent d8b2cfa commit 2c2d3ef92d59ca435b7ae4c5fe98ec679f270ce1
Showing with 3 additions and 8 deletions.
  1. +3 −8 dec-hex-txt/text_to_hex.sh
@@ -1,10 +1,5 @@
#! /usr/bin/sh

printf "Text to convert to Hex:\nText: "
read TEXT
printf "Hex: "
HEX=$( echo $TEXT | xxd -c 256 -ps )
printf ${HEX^^}
# move down 1 line at end
printf "\n"
printf "Text to convert to Hex:\nText: " && read TEXT
# -A n means do not print offsets and -t x1 means that the type of the input is hexadecimal integers of 1 byte
printf "Hex: " && printf "$TEXT" | od -A n -t x1 && printf "\n"
exit 0

0 comments on commit 2c2d3ef

Please sign in to comment.
You can’t perform that action at this time.