diff --git a/SC2005.md b/SC2005.md index 794e03a..95fd2b2 100644 --- a/SC2005.md +++ b/SC2005.md @@ -18,7 +18,9 @@ cat 1.txt # In bash, but faster and still sticks exactly one newline: printf '%s ### Rationale -The command substitution `$(foo)` yields the result of command `foo` with trailing newlines erased, and when it is passed to `echo` it generally just gives the same result as `foo`. +The command substitution `$(foo)` yields the result of command `foo` with trailing newlines erased, and when it is passed to `echo` it generally just gives the same result as `foo`. + +The command `echo "$(false)"` will return true, whereas `false` of course returns false – beware of the ignored exit code before blindly altering scripts. If using `set -e`, the correct substitution of `echo "$(cmd)"` would be `cmd || true`. ### Exceptions