@@ -141,23 +141,24 @@ shell expansions.
141
141
In the following contexts, the quoting to suppress word splitting and pathname
142
142
expansions are not needed.
143
143
144
- - The right-hand sides of variable assignments ... ` v=$var `
145
- - The arguments of conditional commands ... ` [[ $var ]] `
146
- - The argument specified to ` case ` statement ... ` case $var in foo) ;; esac `
144
+ - The right-hand sides of variable assignments ... ` v=WORD ` (e.g. ` v=$var ` )
145
+ - The arguments of conditional commands ... ` [[ WORD ]] ` (e.g. ` [[ $var ]] ` )
146
+ - The argument specified to ` case ` statement ... ` case WORD in foo) ;; esac `
147
+ (e.g. ` case $var in foo) ;; esac ` )
147
148
148
149
In bash-completion, we do not quote them by default. However, there are
149
150
exceptions where the quoting is still needed for other reasons.
150
151
151
152
- When the word * directly* contains shell special characters (space, tab,
152
153
newline, or a character from `` ;|&()<>\\$`'"#!~{ `` ), these characters need to
153
- be quoted. The "* directly* " means that the characters produced by the shell
154
- expansions, such as ` $var ` , are excluded. For example, when one wants to
155
- include a whitespace as a part of the value of the word, the right-hand side
156
- can be quoted as ` v="a b" ` .
154
+ be quoted. The "* directly* " means that the special characters produced by
155
+ shell expansions are excluded here . For example, when one wants to include a
156
+ whitespace as a part of the value of the word, the right-hand side can be
157
+ quoted as ` v="a b" ` .
157
158
- An empty word (i.e., the word whose value is an empty string) is specified by
158
- ` "" ` . The right-hand sides of assignments technically can be an empty string
159
- as ` var= ` , but we still use ` var="" ` there because ` shellcheck ` suggests that
160
- e.g. ` var= cmd ` is confusing with ` var=cmd ` .
159
+ ` "" ` . The right-hand side of an assignment technically can be an empty
160
+ string as ` var= ` , but we still use ` var="" ` there because ` shellcheck `
161
+ suggests that e.g. ` var= cmd ` is confusing with ` var=cmd ` .
161
162
- ` $* ` and ` ${array[*]} ` need to be always quoted because they can be affected
162
163
by the word splitting in bash <= 4.2 even in the above contexts.
163
164
- In the following contexts, double-quoting of shell expansions is needed
0 commit comments