TIL ... many things. But perhaps most surprising, ...
# random
e
TIL ... many things. But perhaps most surprising, to me:
Copy code
$ which "["
/usr/bin/[
I always thought
[ ... ]
was the
sh
builtin and
[[ ... ]]
the bash more advanced version of that builtin and
test
the system utility (
/usr/bin
) equivalent of the
sh
[ ... ]
builtin. But: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
👀 1
c
To clarify, your surprise was that
[
wasn't a builtin, right? Everything else was still on point from what I can tell.
e
Most directly I was surprised to see
[
was a binary on the PATH on my machine. It is not the same binary as
test
and it behaves differently. You must pass it a last argument of
]
or it errors saying that and it accepts
--help
which
test
does not (on my machine). Everything else was coming to grips with that.
👍 1
The other major revelation was that sh was parsed and executed line by line. Not sure how I never learned either of these things before. But the latter means you can plop a bash script on the head of a zip and as long as all code paths explicitly exit or exec, you're golden.