Created
June 2, 2014 04:02
-
-
Save jj1bdx/ac043f442cc6c30f42de to your computer and use it in GitHub Desktop.
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.
Nice
And I thought indenting is a must like it's in python. Thank you so much!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@mhjb 👍