Why didn't the shell command execute in order as I expect?

后端 未结 4 1773
暗喜
暗喜 2021-01-28 16:21

I have written 3 shell scripts named s1.sh s2.sh s3.sh. They have the same content:

#!/bin/ksh
echo $0 $$

and s.sh invoke them in order:

<
4条回答
  •  长发绾君心
    2021-01-28 17:14

    They have been executing in order (at least starting in order - Notice the ids are incrementing). You open 3 separate threads for 3 separate programs. One (for some reason) is faster than the other. If you want them in sequence, take the execs and &s out of exec ./s1.sh &.

提交回复
热议问题