Ascii/Hex convert in bash

前端 未结 15 1509
广开言路
广开言路 2020-12-12 21:03

I\'m now doing it this way:

[root@~]# echo Aa|hexdump -v
0000000 6141 000a                              
0000003
[root@~]# echo -e \"\\x41\\x41\\x41\\x41\"
A         


        
15条回答
  •  长情又很酷
    2020-12-12 21:13

    I don't know how it crazy it looks but it does the job really well

    ascii2hex(){ a="$@";s=0000000;printf "$a" | hexdump | grep "^$s"| sed s/' '//g| sed s/^$s//;}
    

    Created this when I was trying to see my name in HEX ;) use how can you use it :)

提交回复
热议问题