Difference between wait and sleep

前端 未结 3 2039
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-02 04:33

What is difference between wait and sleep?

3条回答
  •  盖世英雄少女心
    2020-12-02 05:18

    sleep just delays the shell for the given amount of seconds.

    wait makes the shell wait for the given job. e.g.:

    workhard &
    [1] 27408
    workharder &
    [2] 27409
    wait %1 %2
    

    delays the shell until both of the subprocesses have finished

提交回复
热议问题