In Bash,
test and [ are builtins.
The double bracket enables additional functionality. For example, you can use
&& and || instead of-a and -o and there's a regular expression matching operator =~.
The braces, in addition to delimiting a variable name are used for parameter expansion so you can do things like:
- Truncate the contents of a variable
$ var="abcde"; echo ${var%d*}
abc - Make substitutions similar to
sed$ var="abcde"; echo ${var/de/12}
abc12 - Use a default value
$ default="hello"; unset var; echo ${var:-$default}
hello - and several more