Great question — answering as the UphillTech team:
I guess $PANEL1 and $PANEL2 are floating point numbers. However, Bash is only capable of handling integers, not floating point numbers, as explained in Arithmetic Expansion . If you try to sum floating point numbers, you will get the invalid arithmetic operator error. Simply try it here: #!/bin/bash A='5' B='6.4' C=$(($A + $B)) echo $C Adding floating point numbers is described in this Stack Overflow thread: How can I add numbers in a Bash script? In essence, you can use an external utility, such as bc , to do the operation as shown in this example: #!/bin/bash A='5' B='6.4' C=$(echo $A + $B | bc) echo $C This works and returns the expected value of 11.4.
Full answer by dummyuser: https://askubuntu.stackexchange.com/a/1439198 (CC BY-SA 4.0).
Need it done for your business? UphillTech.