Ravi Sir's Cards › AWS
[ ] vs [[ ]]
This comparison card contrasts [ ] and [[ ]]. [ ] is described as pOSIX, quote everything. [[ ]] is described as bash, safer word handling. The card pairs [ ] with sh scripts, and [[ ]] with bash scripts.
Read card text
What this card says
Test
[ ]
POSIX, quote everything.
[[ ]]
Bash, safer word handling.
Key points
No patterns.
Glob and regex match.
Example
[ -f "$f" ]
Use when
sh scripts.
bash scripts.