On Thursday 24 September 2009 16:38:12 David Martin wrote: > Description: > When populating an array from a string in a variable does not > handle quotes. > > Repeat-By: > > ~$ declare -a samplearray > ~$ samplearray=( x y 'z k') > ~$ echo ${samplearray[2]} > z k > ~$ samplestring="x y 'z k'" > ~$ samplearray=( $samplestring ) > ~$ echo ${samplearray[2]} > 'z
Not a bug. This is expected behavior. To do what you want, use eval: ~$ samplestring="x y 'z k'" ~$ eval samplearray=( "$samplestring" ) ~$ echo "${samplearray[2]}" z k -- D.