On 1/31/14 10:39 AM, Jonathan Doull wrote:
> Bash Version: 4.2
> Patch Level: 25
> Release Status: release
>
> Description:
>
> Variables can be automatically cast from string to array.
> However when cast from array to string, the cast silently fails.
Not quite. The bash man page says:
"Referencing an array variable without a subscript is equivalent to
referencing the array with a subscript of 0."
This works for both obtaining and assigning values. So, you are partially
correct: assigning to a variable using array assignment syntax converts
it to an array. However, once a variable has been converted to an
array, references without subscripts are equivalent to ${array[0]} or
array[0]=value.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU [email protected] http://cnswww.cns.cwru.edu/~chet/