summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/bash-style.cli13
1 files changed, 13 insertions, 0 deletions
diff --git a/doc/bash-style.cli b/doc/bash-style.cli
index f81479b..9e90e8a 100644
--- a/doc/bash-style.cli
+++ b/doc/bash-style.cli
@@ -224,6 +224,19 @@ along these lines:
rm -f \"$dir/$name\".*
\
+\N|One exception to this quoting rule is arithmetic expansion (\c{$((\ ))}):
+Bash treats it as if it was double-quoted and, as a result, any inner quoting
+is treated literally. For example:
+
+\
+z=$(($x + $y)) # Ok.
+z=$((\"$x\" + \"$y\")) # Error.
+z=$(($x + $(echo \"$y\"))) # Ok.
+\
+
+|
+
+
If you have multiple values (e.g., program arguments) that may contain spaces,
don't try to handle them with quoting and use arrays instead. Here is a
typical example of a space-aware argument handling: