How to add an integer number and a float number in a bash shell script

bash, shell

Solution

echo 1 + 3.5 | bc

awk "BEGIN {print 1+3.5; exit}"

python -c "print 1+3.5"

perl -e "print 1+3.5"

Just replace the numbers with your variables, eg: `echo $n1 + $n2 | bc`

Problem

I have two numbers: ``` value1=686 value2=228.35 ``` I am not able to add an integer and a float. Please help me out to get the result. I am running it in bash.

Original source

Related problems