1 # first, let's start with the basics
30 # If IFS is null, the parameters are joined without separators
34 # If IFS is unset, the parameters are separated by spaces
42 set bob 'tom dick harry' joe
49 set bob 'tom dick harry' joe
56 set bob 'tom dick harry' joe
63 set bob 'tom dick harry' joe
70 # according to POSIX.2, unquoted $* should expand to multiple words if
71 # $IFS is null, just like unquoted $@
73 set bob 'tom dick harry' joe
80 set bob 'tom dick harry' joe
87 # if IFS is unset, the individual positional parameters are split on
88 # " \t\n" if $* or $@ are unquoted
90 set bob 'tom dick harry' joe
97 set bob 'tom dick harry' joe
104 # but not for "$@" or "$*"
105 set bob 'tom dick harry' joe
112 set bob 'tom dick harry' joe
119 # POSIX.2 says these should both expand the positional parameters
126 # this example is straight from the POSIX.2 rationale
141 set -- 1 2 3 4 5 6 7 8 9 10
160 eval foo3='$*' bar3='${*}'
203 eval foo3='$*' bar3='${*}'
227 # tests for the effect of quoting $* and $@ in an assignment context (plus
228 # arrays) -- bugs through bash 4.2
229 ${THIS_SH} ./dollar-at-star1.sub
231 # more tests for expanding $@ and $* in a context where there is no word
233 ${THIS_SH} ./dollar-at-star2.sub
234 ${THIS_SH} ./dollar-at-star3.sub
235 ${THIS_SH} ./dollar-at-star4.sub
236 ${THIS_SH} ./dollar-at-star5.sub
237 ${THIS_SH} ./dollar-at-star6.sub
238 ${THIS_SH} ./dollar-at-star7.sub
240 # tests for expansions of $@ and ${a[@]} (vs. $* and ${a[*]}) on the RHS of
241 # assignment statements with non-default IFS: $@ expands to args or array
242 # members separated by spaces
243 ${THIS_SH} ./dollar-at-star8.sub
245 # tests for special expansion of "$*" and "${array[*]}" when used with other
246 # expansions -- bugs through bash-2.05b
247 ${THIS_SH} ./dollar-star1.sub
249 # tests for expansion of "$@" on rhs of things like ${param:+word}. Bugs
251 ${THIS_SH} ./dollar-at1.sub
253 # tests for expansion of other variables in double-quoted strings containing
254 # $@. Bugs through bash-2.05b
255 ${THIS_SH} ./dollar-at2.sub
257 # tests for various expansions of $* in different contexts -- word split,
258 # no splitting, etc. when $IFS is NUL
259 ${THIS_SH} ./dollar-star2.sub
261 # tests for expansions of "${array[*]}" and "${array[@]}" when $IFS is not the
262 # default and the array contains null elements
263 ${THIS_SH} ./dollar-star3.sub
265 # test for set -u and expansions of $@ when there are no positional parameters
266 ${THIS_SH} ./dollar-at3.sub
267 # test for set -u and expansions of $* when there are no positional parameters
268 ${THIS_SH} ./dollar-star4.sub
270 # tests for expansions of $* when IFS is null
271 ${THIS_SH} ./dollar-star5.sub
273 # tests for inappropriate word splitting through bash-4.2
274 ${THIS_SH} ./dollar-at4.sub
276 # tests for problems with "$@" preceded and followed by other quoted expansions
278 ${THIS_SH} ./dollar-at5.sub
280 # tests for problems with "${@:1}" and other expansions with null entries
281 # in positional parameters
282 ${THIS_SH} ./dollar-at6.sub
284 # tests for expansions of $* when $1 == ""; problem through bash-4.2
285 ${THIS_SH} ./dollar-star6.sub
287 # tests for expansions of $* (unquoted) when IFS changes (e.g., ${IFS:=-})
288 # problem through bash-4.2
289 ${THIS_SH} ./dollar-star7.sub
291 # tests for expansions of $* (unquoted) when IFS is null and word splitting is
292 # not going to be performed.
293 # problem through bash-4.4 in some parameter expansion contexts
294 ${THIS_SH} ./dollar-star8.sub
296 # tests for expansions of "$@" when there are no positional parameter or when
297 # $1 == '' and the expansion is preceded by something that results in a quoted
299 ${THIS_SH} ./dollar-at7.sub
301 # tests for expansions of $* when in an assignment context (no splitting) and
303 ${THIS_SH} ./dollar-star9.sub