"while :" vs. "while true"

bash

Solution

from manual:

: [arguments] No effect; the command does nothing beyond expanding arguments and performing any specified redirections. A zero exit code is returned.

As this returns always zero therefore is is similar to be used as `true`

Check out this answer: What Is the Purpose of the `:' (colon) GNU Bash Builtin?

Problem

When you look at how infinite loops should be implemented, you mostly see this approach: ``` while : do # loop infinitely done ``` But I just don't understand the use of `:` here. Wouldn't it be better to use: ``` while true do # loop infinitely done ``` ?

Original source

Related problems