I looked up in the internet for my problem but could not find an answer. Apologies if it's answered before. This is for bash.
so my script will read an input.dat file and will look to rows and do the arithmetic operation according to it. Example:
#input.dat file:
205 - 12
0xFED - 0xABCD
using the code echo $((p))
where p is the loop count (helps me calculate and print each line) but 0xFED - 0xABCD returns -39904 , but i want it to return its hexadecimal counterpart.
./test.sh input.dat
while read p; do
echo $((p))
done <$1
returns:
193
-39905
but i want it to return a hexadecimal result instead of decimal, if calculation is done on hexadecimal values.
Any idea is welcome!