Skip to content

Instantly share code, notes, and snippets.

@3dgoose
Created December 16, 2024 19:43
Show Gist options
  • Save 3dgoose/d66af1d402d80a12aad50b40e9f06e00 to your computer and use it in GitHub Desktop.
Save 3dgoose/d66af1d402d80a12aad50b40e9f06e00 to your computer and use it in GitHub Desktop.
ASCII to HEX alphabet and numbers
#!/bin/bash
echo "ASCII to HEX alphabet"
letters () {
A=0x41
B=0x42
C=0x43
D=0x44
E=0x45
F=0x46
G=0x47
H=0x48
I=0x49
J=0x4A
K=0x4B
L=0x4C
M=0x4D
N=0x4E
O=0x4F
P=0x50
Q=0x51
R=0x52
S=0x53
T=0x54
U=0x55
V=0x56
W=0x57
X=0x58
Y=0x59
Z=0x5A
linebr="0x0A"
space="20"
echo $A $B $C $D $E $F $G $H $I $J $K $L $M $N $O $P $Q $R $S $T $U $V $W $X $Y $Z
echo "Line break :"
echo $linebr
echo "Space :"
echo $20
}
numbers () {
n1=0x31
n2=0x32
n3=0x33
n4=0x34
n5=0x35
n6=0x36
n7=0x37
n8=0x38
n9=0x39
n0=0x30
echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $n0
echo "Note : 12 is 31 32. 1 then 2. This a rule."
}
echo "[L]etters OR [N]umbers"
read type
if [ $type = 'L' ]; then
letters
elif [ $type = 'N' ]; then
numbers
else
echo "[L] or [N]."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment