获取 shell Linux 中的非 ASCII 字符

Get non ASCII character in shell Linux

我有一个命令 return 非 ASCII 编码的 base64 结果,如何在 shell 变量中获取结果。

有什么解决办法吗?

示例:

$ mycommand|base64 -d > f
# verify presence of character with hexdump command
$ hexdump -C f
00000000  06 05 03 01                                       |....|
00000004

我找到了解决方案:

$ a=`mycommand|base64 -d|hexdump -v -e '1/1 "%02X"'`
$ echo $a
06050301