A bash script demo.sh
#!/bin/bash
./prog1 &
./prog2 &
wait
Use timeout -s 9 5m demo.sh
to run the script.
The script demo.sh used to be without &
and wait
. I want to know whether timeout
will kill prog1 and prog2 when timeout happens. How can I make sure that all subprocesses would be killed?