There is a space missing between elif
and [
:
elif[ "$seconds" -gt 0 ]
should be
elif [ "$seconds" -gt 0 ]
As I see this question is getting a lot of views, it is important to indicate that the syntax to follow is:
if [ conditions ]
# ^ ^ ^
meaning that spaces are needed around the brackets. Otherwise, it won't work. This is because [
itself is a command.
The reason why you are not seeing something like elif[: command not found
(or similar) is that after seeing if
and then
, the shell is looking for either elif
, else
, or fi
. However it finds another then
(after the mis-formatted elif[
). Only after having parsed the statement it would be executed (and an error message like elif[: command not found
would be output).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…