Friday 13 September 2013

addition of values of variable and convert into hexadecimal in shell script

addition of values of variable and convert into hexadecimal in shell script

in a shell script I have a value
variable=8,4,2
now what I suppose to do is add all the numbers = 1+2+3 = 14
how can I achieve this ? sum of this values in shell script ?
convert this decimal number into hexadecimal number
echo "obase=16; 14" | bc
answer = E
but i want to answer in these formats
e
0e
00e
how can I achieve it ?

No comments:

Post a Comment