2

I am writing a shell script that will perform 2 tasks. One task will start up a program that must keep running continuously. Within the same script, the 2nd task is to be initiated that will start up another program. But when the first is running continuously, how can i start another within the same script ?

Thanks in advance.

4

2 回答 2

5

您可能正在寻找背景任务。通常,您会这样做:

sleep 30 &
sleep 30 &
jobs
echo 'Waiting for all jobs to complete.'
wait

背景由行尾的&符号处理。

也可以看看

于 2012-06-29T07:14:46.940 回答
2

在命令后添加 & 符号:

~$我的程序&

它将使程序在后台运行。

于 2012-06-29T07:10:40.597 回答