Hacker News·3 min read·hard
A shell colon does nothing. Use it anyway
O
olexsmir
✦AI Summary
This article explains the utility of the colon command in Unix-like shell scripting, specifically focusing on its use in parameter expansion for error handling. It demonstrates how a single colon can replace multi-line if-statements to validate mandatory script arguments.
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.
technology
✦
Get the full story
Sign up for Headlinne to unlock AI insights, political bias analysis, and your personalized news feed.
Create free accountAlready have an account? Sign in