0
我已经创建了一个脚本来编译然后执行4.c程序。现在Bash脚本 - 如何知道一个程序已经终止
,我的脚本如下:
#!/bin/sh
echo "Compiling first program. . ."
gcc -o first first.c
echo "File compiled."
echo
echo "Compiling second program. . ."
gcc -o second second.c
echo "File compiled."
echo
echo "Compiling third program. . ."
gcc -o third third.c
echo "File compiled."
echo
echo "Compiling fourth program. . ."
gcc -o fourth fourth.c
echo "File compiled."
echo
./first
./second
./third
./fourth
每个可执行文件需要单独运行。 问题是:以这种方式启动高管,他们会同时执行吗?在启动下列程序之前,我如何知道程序何时终止?
您的示例以序列形式启动它们。所以,每一个proram都会在完成之前运行。 (除非程序自行分叉)。对于并行执行,您需要将它们发送到背景(使用'&')或使用'gnu parallel'或'xargs -P'等...... – jm666