我似乎无法弄清楚以下if
陈述的问题是关于elif
和then
.请记住,printf
仍然在开发中我还没有能够在声明中测试它,所以很可能是错误的.
我得到的错误是:
./timezone_string.sh: line 14: syntax error near unexpected token `then'
./timezone_string.sh: line 14: `then'
Run Code Online (Sandbox Code Playgroud)
声明就是这样.
if [ "$seconds" -eq 0 ];then
$timezone_string="Z"
elif[ "$seconds" -gt 0 ]
then
$timezone_string=`printf "%02d:%02d" $seconds/3600 ($seconds/60)%60`
else
echo "Unknown parameter"
fi
Run Code Online (Sandbox Code Playgroud)