[ 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.
yesssql
>However, the value was mostly gone by the mid-to-late 1990s, and the few remaining issues were cleaned up before 2010 — shockingly late, but still over a decade ago.
This is an argument for it: You never know when you'll be on a legacy system. "A decade" isn't that long.
3np
I feel like something's missing here. I recall having to resort to the x-hack not that many years ago to acommodate for compatibility with a system shell somewhere. Beats me if I recall which and where but I'm pretty sure it had to do with empty strings.
tedunangst
Several long threads in the past, too.
Leynos
Of course, I am now wondering why people are using /bin/[ in a shell script in 2024?
rurban
Nobody used it with the quotes. The point was to get rid of the quotes.
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.