ocaml-pkgbuild /

juster 09947d5 

* Bash Expansion
** Parameter Expansion

*** Arrays VS "Scalars"

I forget what non-arrays are called. Anyways...
I want to make sure I understand how treating an array like a "scalar" or
a "scalar" like an array when expanding will give different results.
Copying these results so we can fail predictably would be nice.

1) A scalar is expanded

   :declare FOO=bar
   :echo $FOO

   Result: bar


2) An array is expanded

   :declare -a FOO=(bar baz)
   :echo $FOO

   Result: bar

   Only the first element is expanded out.

3) An indexed scalar is expanded

   :declare FOO='bar baz'
   :echo ${FOO[0]}

   Result: bar baz

   When indexing a scalar, it is equivalent to a one-element array

4) An indexed array is expanded


5) A scalar is expanded for all elements (with @)

   :declare FOO='hello world'
   :echo ${FOO[@]}

   Result: hello world

6) An array is expanded for all elements (with @)