How do I pause my shell script for a second before continuing?

后端 未结 10 2170
借酒劲吻你
借酒劲吻你 2020-11-30 16:26

I have only found how to wait for user input. However, I only want to pause so that my while true doesn\'t crash my computer.

I tried pause(1)

10条回答
  •  执念已碎
    2020-11-30 16:30

    You can make it wait using $RANDOM, a default random number generator. In the below I am using 240 seconds. Hope that helps @

    > WAIT_FOR_SECONDS=`/usr/bin/expr $RANDOM % 240` /bin/sleep
    > $WAIT_FOR_SECONDS
    

提交回复
热议问题