i have a main shell script file m1.sh
and another two script files s1.sh
and s2.sh
.
here i am running s1.sh
and s2.sh
from m1.sh
. But the problem is s2.sh
starts running only after s1.sh
runs completely.
m1.sh
looks like below
$cat m1.sh
#!/bin/bash
./s1.sh
./s2.sh
How can i run s2.sh
when s1.sh
starts running(i dont want to wait until s1.sh
completes)
You can put start them as backgroud process, like
#!/bin/bash
./s1.sh &
./s2.sh &
wait # wait for all background processes to complete
for logfile in ./s1.log ./s2.log
do
... process "${logfile}" as needed
done
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.