title: Hexadecimal To Decimal in Shell Script
body: <p>Can someone help me to convert a hexadecimal number to decimal number in a shell script?</p>
  
  <p>E.g., I want to convert the hexadecimal number <code>bfca3000</code> to decimal using a shell script. I basically want the difference of two hexadecimal numbers.</p>
  
  <p>My code is:</p>
  
  <pre><code>var3=`echo "ibase=16; $var1" | bc`
  var4=`echo "ibase=16; $var2" | bc`
  var5=$(($var4-$var3))               # [Line 48]
  </code></pre>
  
  <p>When executing, I get this error:</p>
  
  <pre><code>Line 48: -: syntax error: operand expected (error token is "-")
  </code></pre>