From 35fd3f01678c63593b80c4abbf1691a79fed2dfe Mon Sep 17 00:00:00 2001 From: Google Shell Style team Date: Mon, 18 May 2020 11:19:09 -0700 Subject: [PATCH] Project import generated by Copybara. PiperOrigin-RevId: 312117514 --- shellguide.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shellguide.md b/shellguide.md index 702c751..6978a98 100644 --- a/shellguide.md +++ b/shellguide.md @@ -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 (especially when compared to things like `sed`). -Example: +Examples: ```shell # Prefer this: -addition=$(( ${X} + ${Y} )) +addition=$(( X + Y )) substitution="${string/#foo/bar}" ``` ```shell # Instead of this: -addition="$(expr ${X} + ${Y})" +addition="$(expr "${X}" + "${Y}")" substitution="$(echo "${string}" | sed -e 's/^foo/bar/')" ```