Syntax for a single-line Bash infinite while loop

前端 未结 13 1409
长情又很酷
长情又很酷 2020-11-29 14:18

I am having trouble coming up with the right combination of semicolons and/or braces. I\'d like to do this, but as a one-liner from the command line:

while [         


        
13条回答
  •  情话喂你
    2020-11-29 14:56

    A very simple infinite loop.. :)

    while true ; do continue ; done
    

    Fr your question it would be:

    while true; do foo ; sleep 2 ; done
    

提交回复
热议问题