bash – 只有在command1成功执行cmd windows shell时,才能运行command2

前端之家收集整理的这篇文章主要介绍了bash – 只有在command1成功执行cmd windows shell时,才能运行command2前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我们如何使用cmd shell语言组合命令,以便仅在第一个命令成功完成时才执行第二个命令?

像以下bash命令

make && ./a.out

a.out只有在make成功的情况下才能执行

下列
command1 && command2

也应该在cmd上工作。报价从here

When using cmd.exe,you can put multiple commands on the same line by using ‘&’ or ‘&&’ between commands. Using a single ampersand (&) will cause the first command and then the second command to be run in sequence. Using double ampersands (&&) introduces error checking. The second command will run only if the first command is successful.

原文链接:https://www.f2er.com/bash/387666.html

猜你在找的Bash相关文章