if [ $i -ne 7 ]; then echo "MPR:powrer_sum|0|W" echo "ERROR: Check power count is not 7" exit -1 else echo "-----------------------------------------------" awk -v var0=${power_array[0]} -v var1=${power_array[1]} -v var2=${power_array[2]} -v var3=${power_array[3]} \ -v var4=${power_array[4]} -v var5=${power_array[5]} -v var6=${power_array[6]} -v pow_lim=$pow_high_lim \ BEGIN'{ printf "MPR:leakge_power_sum|%.4f|W\r\n",var0+var1+var2+var3+var4+var5; \ if[((var0+var1+var2+var3+var4+var5+var6) < pow_lim)&&('$sd5223c_request' -eq 1)]{printf "Leakage 5223 test pass\n"} else {printf "Leakage test fail\n"} }' fi这句话有没有语病
时间: 2024-04-09 11:28:59 浏览: 149
这句话有一处语法错误。在if语句的条件判断部分,应该使用双括号(( ))来包裹条件表达式,并且逻辑运算符&&的使用也不正确。正确的写法如下:
```bash
if (( $i -ne 7 )); then
echo "MPR:powrer_sum|0|W"
echo "ERROR: Check power count is not 7"
exit -1
else
echo "-----------------------------------------------"
awk -v var0=${power_array[0]} -v var1=${power_array[1]} -v var2=${power_array[2]} -v var3=${power_array[3]} \
-v var4=${power_array[4]} -v var5=${power_array[5]} -v var6=${power_array[6]} -v pow_lim=$pow_high_lim \
BEGIN'{ printf "MPR:leakge_power_sum|%.4f|W\r\n",var0+var1+var2+var3+var4+var5; \
if (( (var0+var1+var2+var3+var4+var5+var6) < pow_lim)) && ((sd5223c_request == 1)); then \
printf "Leakage 5223 test pass\n" \
else \
printf "Leakage test fail\n" \
fi }'
fi
```
注意,我在修正语法错误的同时,还对if语句中的条件判断和awk命令的执行逻辑进行了修正。
阅读全文