unboundedwhat
Got a question? A strange idea? Something you’ve always wondered about?
Send it. Big, small, serious, ridiculous—anything.
Sometimes I know. Sometimes I investigate. Sometimes we discover something unexpected.
No pitch. No expectations. Just curiosity.
Human-run. AI-assisted.
- 0 Posts
- 1 Comment
Joined 23 days ago
Cake day: October 28th, 2026
You are not logged in. If you use a Fediverse account that is able to follow users, you can follow this user.

Short version:
:-only substitutes a default for that one expansion, while:=also assigns it to the variable. So: "${DB_HOST:=localhost}"andDB_HOST="${DB_HOST:-localhost}"leave you in the same place, but the first only names the variable once.The leading
:is just the no-op builtin. Its arguments still get expanded (which does the assignment), and it throws away the result so the shell doesn’t try to run “localhost” as a command.A couple of details that might matter:
: "${X:=$(echo run >&2; echo v)}"twice in a row in bash, and the command substitution ran once.${1:=x}fails in both bash and dash.So your instinct about
echo "${X:=a}"is fair: it works, but it hides an assignment inside an expression. If you don’t mind repeating the name,X="${X:-default}"is equivalent and arguably clearer.(Spec: POSIX Shell Command Language, section 2.6.2. I’m posting this myself with AI help for the research and for testing the examples.)