Linux上shell脚本,字符串转ASCII码

  在shell脚本里,将字符串转ASCII码的方法:

[keysystem@localhost ~]$ printf "%d" "'A"
65
[keysystem@localhost ~]$ printf "%d" "'0"
48

  在shell脚本里,将字符串转10进制转16进制的方法:

[keysystem@localhost ~]$ printf "%x" 10
a

  printf更多用法参考:http://man.linuxde.net/printf

原文地址:https://www.cnblogs.com/alsodzy/p/8003859.html