Updated SC2193 (markdown)

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

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