小编use*_*207的帖子

Why let command doesn't work to add real numbers?

I need to add some real numbers in a script. I tried:

let var=2.5+2.5 
Run Code Online (Sandbox Code Playgroud)

which gives me an error - invalid arithmetic operator and then I tried:

let var=2,5+2,5 
Run Code Online (Sandbox Code Playgroud)

which does not give me an error, but it gives me a wrong result -2 in this case.

Why? How to add real numbers using let or other command?

command-line bash

3
推荐指数
1
解决办法
5884
查看次数

标签 统计

bash ×1

command-line ×1