Thank you for all and sorry for the noise, you were right. David.
On Thu, Sep 24, 2009 at 6:38 PM, Chris F.A. Johnson <ch...@cfajohnson.com> wrote: > On Thu, 24 Sep 2009, David Martin wrote: > >> Configuration Information [Automatically generated, do not change]: >> Machine: x86_64 >> OS: linux-gnu >> Compiler: gcc >> Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' >> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' >> -DCONF_VENDOR='pc' -DLOCALEDI$ >> uname output: Linux bristol 2.6.31 #10 SMP Thu Sep 10 17:59:29 CEST >> 2009 x86_64 GNU/Linux >> Machine Type: x86_64-pc-linux-gnu >> >> Bash Version: 4.0 >> Patch Level: 33 (debian bash-4.0-7) >> Release Status: release >> >> 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 ) > > eval "samplearray=( $samplestring )" > >> ~$ echo ${samplearray[2]} >> 'z > > -- > Chris F.A. Johnson, webmaster <http://woodbine-gerrard.com> > =================================================================== > Author: > Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress) >