1、实践
#!/bin/bash
sleep 10
echo "helloworld1"
echo "helloworld2"
echo "helloworld3"
echo "helloworld4"
#!/bin/bash
sleep 3
echo "test1"
#!/bin/bash
./a.sh &
wait
./b.sh &
wait
echo "sleep done"
执行test1.sh脚本:
[root@i-9c4f304f ceshi]# ./test1.sh
helloworld1
helloworld2
helloworld3
helloworld4
test1
sleep done
#!/bin/bash
./a.sh &
./b.sh &
echo "sleep done"
执行test2.sh命令:
[root@i-9c4f304f ceshi]# ./test2.sh
sleep done
test1
helloworld1
helloworld2
helloworld3
helloworld4
#!/bin/bash
./a.sh &
./b.sh &
wait
echo "sleep done"
执行test3.sh命令:
[root@i-9c4f304f ceshi]# ./test3.sh
test1
helloworld1
helloworld2
helloworld3
helloworld4
sleep done
2、总结