Time condition loop in shell

后端 未结 8 1552
故里飘歌
故里飘歌 2020-12-04 10:34

I have just started learning shell script recently, so I don\'t know much about it.

I am trying to find example of time based while loop but not having any luck.

8条回答
  •  -上瘾入骨i
    2020-12-04 10:41

    You can try this

    starttime = `date +%s`
    while [ $(( $(date +%s) - 3600 )) -lt $starttime ]; do
    done
    

    where 'date +%s' gives the current time in seconds.

提交回复
热议问题