Created SC2060 (markdown)

koalaman
2014-02-24 17:55:43 -08:00
parent c47b2409a0
commit 01122d5594

17
SC2060.md Normal file

@@ -0,0 +1,17 @@
# Quote parameters to tr to prevent glob expansion.
### Problematic code:
tr -cd [:digit:]
### Correct code:
tr -cd '[:digit:]'
### Rationale:
`[:digit:]` is a shell glob that matches any single character file named e.g. `g` or `t` in the current directory. Quoting it prevents the script from breaking in directories with files like this.
### Contraindications
None