bash中"let"的奇怪错误 [英] A strange error of 'let' in bash
本文介绍了bash中"let"的奇怪错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道下面的代码语法是否错误?
I wonder if the code below has wrong syntax ?
#!/bin/bash
set -e
let "time_used = 1 - 1"
echo $time_used
当我运行它时,什么也没打印.该脚本死于 let"time_used = 1-1"
.
When I run it, nothing print. The script died on let "time_used = 1 - 1"
.
如果我在第二行中删除 set -e
,则会得到正确的结果 0
.
If I remove set -e
in second line, I get the correct result 0
.
为什么会这样?
推荐答案
查看全文