script sstream.sh:
#!/bin/bash
for num in $(echo "9e 8b 5a")
do
echo $((16#$num)) | awk '{printf("%c", $0);}'
doneInvoke the script:
$bash sstream.sh | hexdump -C
00000000 9e 8b 5a |..Z|
00000003
本文介绍了一个使用bash脚本将十六进制字符串转换为字符的过程,通过实例展示了如何使用sstream.sh脚本来实现这一功能,并通过hexdump命令验证结果。
script sstream.sh:
#!/bin/bash
for num in $(echo "9e 8b 5a")
do
echo $((16#$num)) | awk '{printf("%c", $0);}'
done$bash sstream.sh | hexdump -C
00000000 9e 8b 5a |..Z|
00000003
492
2412

被折叠的 条评论
为什么被折叠?