Y
Hacker News
new
|
ask
|
show
|
jobs
by
porridgeraisin
216 days ago
nit: while test and [ are binaries, [[ is a bash keyword.
2 comments
__david__
216 days ago
Another nit, while test and [ are indeed binaries, they are also bash built-ins (for performance, presumably) so bash won’t exec them normally.
link
porridgeraisin
216 days ago
True! And for those curious, you can enable disable this shadowing per command, like so:
enable test enable -n test # disable enable -n [
You can also use
command test -f file.txt
To override builtins once.
link
jeroenhd
216 days ago
Ah, you're right of course. Thank goodness for shellcheck keeping my .sh scripts compatible.
link