Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在unix中完成command1后执行command2的shell脚本_Shell_Serial Processing - Fatal编程技术网

在unix中完成command1后执行command2的shell脚本

在unix中完成command1后执行command2的shell脚本,shell,serial-processing,Shell,Serial Processing,如果我有一个unixshell脚本,它在需要运行的每一行上都有一些命令,比如 #!/bin/bash command1 command2 命令2仅在完成命令1后执行。如何实现它你已经做到了。bash通常会等待每个命令运行,然后再运行下一个命令。如果用符号(&)结束命令,那么它会在后台运行命令,但由于您没有这样做,因此每个命令都会同步运行

如果我有一个unixshell脚本,它在需要运行的每一行上都有一些命令,比如

#!/bin/bash
command1
command2

命令2仅在完成命令1后执行。如何实现它

你已经做到了。bash通常会等待每个命令运行,然后再运行下一个命令。如果用符号(
&
)结束命令,那么它会在后台运行命令,但由于您没有这样做,因此每个命令都会同步运行