0

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?

2
  • 1
    See also the bash manual about [[ ... ]] where it says "Word splitting and pathname expansion are not performed on the words between the [[ and ]]". Commented Feb 16, 2018 at 7:56
  • I missed that. Thanks for the clarification. Commented Feb 16, 2018 at 9:51

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.