Use It Anyway
Based on Hacker News Discussion
135 points
A command that does nothing, yet does everything
# The colon command - does nothing, returns true
:
# Equivalent to 'true' command
: && echo "Success!"
# Exit status is always 0
: ; echo $?
The colon command executes successfully and returns exit code 0, making it perfect for control flow and placeholder scenarios.
Practical patterns that make the colon indispensable
Create clean while loops: while :; do ...; done
Default values syntax: : ${VAR:=default}
Block comments: : 'comment text here'
Stub functions and config file placeholders
Safe if-then syntax when you need no action
Built-in command—no external process overhead
Sometimes the most powerful tools do the least