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

前端 未结 4 1698
故里飘歌
故里飘歌 2021-01-03 23:58

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 a

4条回答
  •  滥情空心
    2021-01-04 00:41

     #!/bin/Bash
    echo "Enter the two numbers to be added:"
    read n1
    read n2
    answer=$(($n1+$n2))
    echo $answer
    

提交回复
热议问题