Convert decimal to hexadecimal in UNIX shell script

后端 未结 11 841
孤城傲影
孤城傲影 2020-11-29 19:08

In a UNIX shell script, what can I use to convert decimal numbers into hexadecimal? I thought od would do the trick, but it\'s not realizing I\'m feeding it ASCII represent

11条回答
  •  感动是毒
    2020-11-29 19:33

    bash-4.2$ printf '%x\n' 4294967295
    ffffffff
    
    bash-4.2$ printf -v hex '%x' 4294967295
    bash-4.2$ echo $hex
    ffffffff
    

提交回复
热议问题