[ -f *.zip ]
is a working solution to check for the existence of one1 zip file, but [[ -f *.zip ]]
isn't:
$ bash --version
[...]
GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu)
[...]
$ ls -a
. ..
$ touch a.zip
$ [ -f *.zip ] && echo true || echo false
true
$ [[ -f *.zip ]] && echo true || echo false
false
Why would [[
implementation not expand globs? Has it been documented to be an improvement on what [
did naturally (as it is a command invoked after glob has been expanded)?
1) Globs are not only useful to list multiple files, it is a valid solution to identify a unique file you only know part of the name.