A shell colon does nothing. Use it anyway
The article explains the purpose and uses of the shell colon, a built‑in null command that performs no action but evaluates its arguments. It demonstrates how the colon can be combined with parameter expansion for argument validation, default assignment, and file redirection tricks. Historical context and frequently asked questions are also included.
- ▪The colon (:) acts as a null‑command that does nothing but evaluate its arguments, originating from the 1971 Thompson shell.
- ▪Using ${var:?message} with the colon allows scripts to check for required arguments and abort with a diagnostic if a variable is unset or empty.
- ▪Parameter expansion forms like ${var:=default} can be prefixed with the colon to set defaults without executing a command.
- ▪The colon can be used with redirection operators to truncate files or test file readability and writability without invoking external commands.
2 outlets in our directory ran this story, first to last over 33 hours. All of the coverage we found sits in one bucket: centre. That one-sidedness is itself worth noticing.
- ▪ A shell colon does nothing. Use it anyway — Lobsters
Lobsters files mainly under programming. We currently carry 187 of its stories.
Story provenance
Source · retrieval · rights · ranking — open for full record
inspect →
Attribution is not the same as permission. This drawer separates discovery metadata, excerpts, WeSearch-generated summaries, reuse status, and whether the publisher receives the visit. Nothing here claims a legal grant the publisher has not made.
Record
| Original publisher | Refp |
| Canonical URL | https://refp.se/articles/your-shell-and-the-magic-colon |
| Publication time | Sat, 25 Jul 2026 06:33:00 -0500 |
| Retrieval time | 2026-07-27T05:52:33.481Z |
| Last seen | 2026-07-27T05:52:33.481Z |
| Headline source | Publisher (no WeSearch rewrite) |
| Excerpt source | publisher body |
| Excerpt method | First ~120 words (~800 chars) of extracted publisher body, fair-use limited. |
| Summary | WeSearch · cerebras-chat (WeSearch summarizer) |
| Summary source text | contentText |
| Citation coverage | Summary is a WeSearch-generated derivative; primary citation is the original publisher URL. |
| Cluster | CbscwuBBSita · 3 stories |
| Cluster logic | Grouped by semantic title/content similarity across sources within a rolling window. Same-publisher template collisions are excluded from coverage comparison. |
| Ranking reason | Story pages are not engagement-ranked. Hub feeds use recency, with optional source-diversified chronological ordering (cap consecutive stories per source). No personalized ranking. |
| Publisher visit | Yes — open original |
| Substitutes article? | No — link-out required for full text |
Rights status (four layers)
WeSearch handling by dimension
| Indexing | May the item be indexed (stored, ranked, made findable)? | Allowed |
| Snippet | May a short excerpt of the publisher's text be shown? | Allowed |
| AI summary | May WeSearch generate its own short summary of the article? | Limited |
| Retrieval / RAG | May the content be exposed for third-party retrieval-augmented generation? | Not asserted |
| Model training | May the content be used to train AI models? | Not asserted |
| Commercial reuse | May the content be reused commercially? | Not permitted |
Basis: Derived from the published RSS/Atom feed. Contact: [email protected]. Reviewed: 2026-07-24.
Opening excerpt (first ~120 words) tap to expand
A shell colon does nothing. Use it anyway.I've written more shell scripts than I can count, but I still stumble upon tricks that honestly blow my mind far too often than I care to admit. Latest thing that blew my head clean off? The shell colon. Published23 July 2026 at 03:53 UTCModified26 July 2026 at 05:33 UTCAuthorFilip RoséenTags#shell#posix#unixTable of ContentsIn a land far-far away..Checking for required argumentsParameter expansion and the story of :?That.. other colonMore colons in the limelightCon-colon-sionFrequently Asked QuestionsWhy do I need the null-command? Doesn't the expansion happen without the colon?Why use the null-command when I could do VAR=${VAR:-default-value}?Why would I do any of these when it hurts readability? In a land far-far away.. # ...
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at Refp.