HN Hall of Fame Weekly email

What was the point of [ “x$var” = “xval” ]?

www.vidarholen.net Essays & writing Essays & articles Software engineering Candidate
Screenshot of www.vidarholen.net captured 2026-07-20
Page preview · captured 2026-07-20

Resurfaced independently across 3 calendar years, with breakout response in 2 of them.

submissions
3
submitters
3
observed span
2021–2024
peak thread · 226 comments
414 pts
latest 20+ return · 2024-09-28
82 pts

Submission timeline

2007–2026

One 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 order

It's still relevant if you use -a, -o, or parentheses (which I guess is reason to avoid them): $ a=1; b=1; c='!'; d='!' $ [ "$a" = "$b" -a "$c" = "$d" ] -bash: [: too many arguments $ [ '!' '(' "$c" = "$d" ')' ] -bash: [: `)' expected, found ! $ echo "${BASH_VERSION}" 5.1.4(1)-release Note that it's not even a bug here; it's necessary for disambiguation.

Discussed extensively last year: https://news.ycombinator.com/item?id=26776956 One key point there is that it’s still easy to trigger cases where you need this hack, because the cleverness is only stable for up to four arguments; so and, or, and parentheses all exceed the point of safety.

[ wasn't an operator or language construct but an external program similar or the same as test. ] was a final argument. In today's world where bash is and does supplant POSIX for all intents and purposes, use [[ and (( because they're part of the interpreter and more flexible.

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
2

100+ points or 50+ comments

Total points
753

reference only — not used in Hall rules or ranking

Total comments
436

reference only — not used in Hall rules or ranking

Every submission

DateTitle as submittedByPointsComments
2021-04-12What was the point of [ “x$var” = “xval” ]?First breakout · Best threadJNRowe414226
2023-03-04What was the point of [ “x$var” = “xval” ]?pabs3257161
2024-09-28What was the point of [ "x$var" = "xval" ]? (2021)Latest 20+ point returnfanf28249