更新时间:2022-01-27 23:03:02
您列出的测试:
test
test
但更强大)test
test
but more powerful)并非详尽无遗,您可以使用布尔逻辑
are not exhaustive, you can use boolean logic
if command; then ...
也是,因为命令有退出状态.在 bash
中,0
是 true
并且 > 0
是 false
.
too, because the commands have exit status. In bash
, 0
is true
and > 0
is false
.
你可以看到这样的退出状态:
You can see the exit status like this :
command
echo $?
见:
http://wiki.bash-hackers.org/syntax/basicgrammar
http://wiki.bash-hackers.org/syntax/arith_expr
http://mywiki.wooledge.org/BashGuide/TestsAndConditionals