Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我有一个 UNIX shell 脚本,它在需要运行的每一行都有一些命令,比如
#!/bin/bash command1 command2
只有在 command1 完成后才会执行 command2。如何实现它
你已经做到了。bash 通常在运行下一个命令之前等待每个命令运行。如果您以 & 符号 ( &) 结束命令,则它会在后台运行该命令,但由于您尚未这样做,因此每个命令都会同步运行。
&