Run command every second in Bash?

后端 未结 3 2046
闹比i
闹比i 2020-12-14 05:37

I want to write some image downloader and assign it on bash. What I have and what I need:

I have:

  1. Command, which works fine (something like wget
3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-14 06:11

    If you want to run a command at one second intervals (one second between the end of one command and the beginning of the next, which is not the same as running every second), just do:

    while sleep 1; do cmd; done
    

    If you want that to start on reboot, the method will depend on your system.

提交回复
热议问题