This question already has an answer here:
Suppose we have a file like 'abc.txt' which has a single value
123456 and file 'xyz.txt' which also has a single value like
654321. I want to store these values form the file to some shell variable like
abc = 123456 and
xyz = 654321 and wanted to do some operations like
density=$abc/$xyz. I am able to transfer the contents form the file to variables but it is not treating contents of shell variables like numbers on which we can do arithmetic. What can be done for this?
How to do integer & float calculations, in bash or other languages/frameworks? link has helped various ways to do arithmetic but did not tell about the values from the file assigned to variable will be eligible for arithmetic or not?