表达式中的语法错误(错误令牌为“ 1”)bash脚本

时间:2019-01-25 17:18:06

标签: bc lvm

当我尝试测试以下内容时,我收到语法错误,这似乎是由于那里的0。我在这里想念什么?

这是代码:

echo =========================================
echo sum of 4 arguments:"$requestedsum"
if [ -n "$requestedsum" ]
then 
(( $(echo "$requestedsum > $vg_free_space" |bc)));
echo "Requested space is not available in VG";
else
echo "Requested space is available";
fi


=========================================
sum of 4 arguments:0
10
./sizecheck.sh: line 26: ((: 0
1: syntax error in expression (error token is "1")
Requested space is not available in VG

1 个答案:

答案 0 :(得分:0)

我看到了: requestsum ='0 10'

似乎不是一个简单的值。尝试为请求的值分配一个简单的值。