linux:命令行 &&与||

参考:

        Linux 命令行 &&与|| - 简书

总结:

        command1 && command2 只有前面命令执行成功,后面命令才继续执行

        shell中&&左边的命令(命令1)返回真(即返回0,成功被执行)后,&&右边的命令(命令2)才能够被执行

        command1 || command2

        只有在 || 左边的命令返回假(命令返回值 $? == 1),|| 右边的命令才会被执行

猜你喜欢

转载自blog.csdn.net/qq1090504117/article/details/131622212