Submission timeline
2007–2026One slot for every year since HN launched. Height is that year's peak points; orange marks a 100+ point or 50+ comment breakout. Select a bar to open its strongest thread.
First comments on top threads
HN comment orderShout out to Shellcheck (http://www.shellcheck.net/), a linter for shell scripts
The single biggest shell script mistake is not handling whitespace in file names correctly, and it's almost impossible to do correctly if you have weird file names: embedded newlines, leading and trailing spaces, embedded tabs. Embedded quotes can be tricky too, especially if you're writing a script that generates a script. That bit, writing a script that generates a script, happens surprisingly often in bash. It's cheaper to pipe a stream to sed that converts it into a shell command…
Advice at a higher level: don’t try too hard to handle error cases in your scripts. The best shell scripts are a list of imperative instructions to get something done. If an error occurs, bail as early as possible and with a useful message. Don’t try any harder than that. For example: if ! complex_function then handle_error fi …doesn’t work as you’d expect because the “if” context changes the rules of set -e in complex_function. It’s much better to have…
Note the #status anchor is best removed from the url
The first top-level comment from each of the four biggest threads, in HN’s own order. Excerpts are shortened; open a comment for full context.
- Breakout years
- 3
- Total points
- 388
- Total comments
- 168
100+ points or 50+ comments
reference only — not used in Hall rules or ranking
reference only — not used in Hall rules or ranking
Every submission
| Date | Title as submitted | By | Points | Comments |
|---|---|---|---|---|
| 2010-01-17 | Common shell script mistakes | miles | 20 | 0 |
| 2013-11-17 | Shell script mistakesFirst breakout | reinhardt | 117 | 34 |
| 2016-06-03 | Common shell script mistakes (2008)Best thread | pmoriarty | 166 | 79 |
| 2016-09-19 | Common shell script mistakes | ot | 4 | 2 |
| 2021-12-07 | Common shell script mistakes (2008)Latest 20+ point return | gautamsomani | 81 | 53 |
