- `[` is a command (basically a variant of the `test` command). `[[` is a builtin in many shells. - When you write `foo*` inside `[...]` [filename expansion](https://www.gnu.org/software/bash/manual/bash.html#Filename-Expansion) (aka globbing) occurs; while inside `[[...]]` [pattern matching](https://www.gnu.org/software/bash/manual/bash.html#Pattern-Matching) occurs. - `[[` is more powerful and capable than `[` but should not be used if portability is a concern. - `[` and `[[` are not part of the `if` syntax, you can use them as in `[ "$exit" = 'yes' ] && exit`. - Inside `[...]` you should prefer `=` instead of `==`. As far as I know, the second one is accepted in many shells but is not POSIX-compliant. By the way, I recommend you to double-quote your variables even if you really know how [word splitting](https://www.gnu.org/software/bash/manual/bash.html#Word-Splitting) will behave.