Linux / UNIX: Convert Hexadecimal to Decimal Number by Vivek Gite on February 6, 2009 · 16 comments · last updated at November 23, 2010 H ow do I convert hex number to decimal number using a shell script under UNIX / Linux operating systems? Hexadecimal (hex) is a numeral system with a radix, or base, of 16. It uses sixteen distinct symbols, most often the symbols 0–9 to represent values zero to nine, and A, B, C, D, E, F (or a through f) to represent values ten to fifteen. bc - An arbitrary precision calculator language There is no need to write a shell script. You can simply use the following syntax at the shell prompt to convert hex to decimal number or vice versa. bc: Hexadecimal or Binary Conversion To convert to decimal, set ibase to 16, enter: echo "ibase=16; hex-number" |bc echo "ibase=16; FFF" |bc Sample output: 4095 To convert to hexadecimal, set obase to 16, enter: echo "obase=16; decimal-number" |bc echo "obase=16; 10" |...