Updated SC2193 (markdown)

koalaman
2018-01-19 11:50:15 -08:00
parent 42cfcf764e
commit 5655e240fe

@@ -3,17 +3,19 @@
### Problematic code: ### Problematic code:
```sh ```sh
[[ "{$var}" == "value" ]] # Swapped around $ and { [ $var+1 == 5 ] # Unevaluated math
[[ "$(cmd1) | cmd2" == "42" ]] # Ended with ) too soon [ "{$var}" == "value" ] # Swapped around $ and {
[[ "$var " == *.png ]] # Trailing space [ "$(cmd1) | cmd2" == "42" ] # Ended with ) too soon
[[ "$var " == *.png ]] # Trailing space
``` ```
### Correct code: ### Correct code:
```sh ```sh
[[ "${var}" == "value" ]] # Correct variable expansion [ $((var+1)) == 5 ] # Evaluated math
[[ "$(cmd1 | cmd2)" == "42" ]] # Correct command substitution [ "${var}" == "value" ] # Correct variable expansion
[[ "$var" == *.png ]] # No trailing space [ "$(cmd1 | cmd2)" == "42" ] # Correct command substitution
[[ "$var" == *.png ]] # No trailing space
``` ```
### Rationale: ### Rationale: