Add whole-string quoting rule to bash style guide
This commit is contained in:
@@ -48,6 +48,7 @@ function do_thing() {
|
||||
- `(( ))` for arithmetic comparisons
|
||||
- `$(command)` for substitution, never backticks
|
||||
- Double quotes around expansions: `"$var"`, `"${array[@]}"`
|
||||
- Quote the whole string, not just the variable: `"$HOME/.local/bin"` not `"$HOME"/.local/bin`
|
||||
- Single quotes for literals that must not expand
|
||||
- `printf` over `echo` when output contains escapes or format strings
|
||||
|
||||
|
||||
Reference in New Issue
Block a user