bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in array populating does not respect quotes


From: Chris F.A. Johnson
Subject: Re: Bug in array populating does not respect quotes
Date: Thu, 24 Sep 2009 12:38:25 -0400 (EDT)
User-agent: Alpine 2.00 (LMD 1167 2008-08-23)

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)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]