I have a context where I need to convert binary to hexadecimal and decimal and viceversa in a shell script. Can someone suggest me a tool for this?
Shell Script – Binary to Hexadecimal and Decimal Conversion
arithmeticbinaryshell-script
arithmeticbinaryshell-script
I have a context where I need to convert binary to hexadecimal and decimal and viceversa in a shell script. Can someone suggest me a tool for this?
Best Answer
It's fairly straightforward to do the conversion from binary in pure bash (
echo
andprintf
are builtins):Binary to decimal
Binary to hexadecimal
Going back to binary using bash alone is somewhat more complex, so I suggest you see the other answers for solutions to that.