shell one-liner for infinite loop

0 minute read

This is for a quick reference (copy-pasta).

While loop

This is compatible with all POSIX complient shells.

while true; do date; sleep 5; done

For loop

If you don’t need to support sh

for ((;;)) { date ; sleep 5 ; }