A best practice is to say what you mean, rather than taking advantage of a side effect of a command. It makes the code more readable and decreases the chances for errors in the future. Type the following: type -a true (while true; do).

Remember that bash is an interpretted language and words are parsed. For example, those just learning might not know that the single bracket ("[") is a shell builtin command itself and the double bracket ("[[") is a reserved word. They may appear to do the same thing, but they do it differently and errors can occur with one but not the other. Those types of things are important to understand, imho. Bottom line, Termy is just looking for an exit status of 0 or success from a command list, that could be any command. But let's call ":" what it is: the null command.

Last edited by lmuserx4849 on Sun Dec 03, 2017 4:30 pm, edited 2 times in total.

like "true", ":" has a return status of 0.true; echo $? returns 0:; echo $? also returns 0
That is why it can be used in a while loopwhile :; do echo -n "Mrmajik45 "; done which does the same as while true; do echo -n "Mrmajik45 "; done

Now, "false" has a return status 1false; echo $?
Therefore false would be not true "! :" notice the space between! :;echo $?until false ; do echo -n "Mrmajik45 ";done does the same as until ! : ; do echo -n "Mrmajik45 ";done

But ":" is a valid name for a function
You can declare it false:(){ false; } now if you execute this function :; echo $? it will return status 1
It also won't start a loop while :; do echo -n "Mrmajik45 "; done unless you declare the function like this:(){ true; }

I'm aware of all that, but I think you're being pedantic here. Maybe it would've been better for me to say that it can be used as shorthand for true. : always has an exit status of zero. What xenopeek said, basically.