无法评估shell脚本
问题描述:
我试图评估以下表达式:有08.这不是对待它"Couldn't evaluate expression operands as numeric as required by the expression operator."
无法评估shell脚本
似乎有问题:
a= 08
b= 5
echo `expr $a + $b`
它给人的错误作为8.
由于提前, Milind
答
在08
前导0
表示八进制文字和8
不是有效的八进制数字。
解决这种表达的方法是什么? – Milind
删除前导零? – Bathsheba
我有三个值00:01:08,00:01:18和00:01:11 这是时间戳我想将其转换为秒,因此我将hh mm ss值分配给三个变量并使用转换公式(hh * 3600 + mm * 60 + ss)试图解决这个问题。我无法消除第一个值08 – Milind