by js2 · 5y ago · 0 comments
https://www.gnu.org/software/bash/manual/html_node/Bourne-Sh...
They also exist as executables for ancient backwards compatibility.
"[[" is a so-called "conditional construct":
https://www.gnu.org/software/bash/manual/html_node/Condition...
I have a somewhat quirky style and almost always use "if test ..." since I find it clearer than "[" and usually don't need the additional functionality that "[[" provides.
(For similar reasons, whenever I'm grepping for a nontrivial regex, I always use egrep rather than grep, because the escaping semantics are simpler—"if it's escaped with a \, then it's not special"—and again I do not want to have the information of "which characters are special only when escaped in base grep" in my brain.)
Tangential but relevant to the Edit thread today were vis was mentioned, “No more {very-,}{no,}magic modes with different semantics and escaping rules. Instead we use the familiar and predictable POSIX Extended Regular Expression variant.”¹ is a real advantage over vim.
¹https://github.com/martanne/vis/wiki/Differences-from-Vi(m)#...