Project import generated by Copybara.

PiperOrigin-RevId: 312117514
This commit is contained in:
Google Shell Style team 2020-05-18 11:19:09 -07:00 committed by Michael Diamond
parent 7a59e424c8
commit 35fd3f0167

View File

@ -1253,17 +1253,17 @@ We prefer the use of builtins such as the *Parameter Expansion*
functions in `bash(1)` as it's more robust and portable functions in `bash(1)` as it's more robust and portable
(especially when compared to things like `sed`). (especially when compared to things like `sed`).
Example: Examples:
```shell ```shell
# Prefer this: # Prefer this:
addition=$(( ${X} + ${Y} )) addition=$(( X + Y ))
substitution="${string/#foo/bar}" substitution="${string/#foo/bar}"
``` ```
```shell ```shell
# Instead of this: # Instead of this:
addition="$(expr ${X} + ${Y})" addition="$(expr "${X}" + "${Y}")"
substitution="$(echo "${string}" | sed -e 's/^foo/bar/')" substitution="$(echo "${string}" | sed -e 's/^foo/bar/')"
``` ```