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