A shell one-liner for an infinite loop (sh/zsh/bash compatible)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while true; do date; sleep 5; done |
If you don't need to support sh
then why bother with do
and done
?
for ((;;)) { date ; sleep 1 ; }
I find this one more readable because of curly brackets.
for ((;;))date&&sleep 1
even fewer bytes, in zsh
at least :)
Just what I needed. Thanks!
I've got nothing personal against zsh or bash, and I appreciate shorter scripts posted for bash and zsh. Still, maintaining the backward compatibility even in such a small script like in this gist is important.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@mhjb👍