本指南说:
An if/then construct tests whether the exit status of a list of commands is 0
Run Code Online (Sandbox Code Playgroud)
如果我0在 bash 中执行,它会说:
0: command not found
Run Code Online (Sandbox Code Playgroud)
所以它的退出状态不是 0,也[ 0 ]应该返回一个非零值的退出状态。但它实际上返回 0 退出状态,并if [ 0 ]执行then语句,而不是else语句。
谁能解释一下?