title: how to print the decimal value to hex values in shell script
body: <p>I have a requirement of having a string which has a decimal value. For e.g., '0 2930 0'. Now , when i convert it to hex, it should say '0000 0B72 0000'. i'm able to convert  the values to hex using split and obase=16 with bc, i'll get the answer as '0 B72 0'. What i needed is to get the value '0000 0B72 0000'. Can anyone help shed some light on this?</p>
  
  <p>Here is what i've done:</p>
  
  <pre><code>s1 ='2930'
  echo after converting it to hexadecimal
  s=`echo "obase=16; $s1" |bc`
  echo $s
  </code></pre>