I just discovered that in bash,[[ -d foo-* ]]
returns false ($?
set to 1) even if a directory named foo-bar
exists while [ -d foo-* ]
returns true ($?
set to 0)
I have to admit that I was surprised as I expected both versions to return true.
What is the rational behind this differing outcome?
bash
manual about[[ ... ]]
where it says "Word splitting and pathname expansion are not performed on the words between the[[
and]]
". – Kusalananda Feb 16 '18 at 07:56