bug-bash
[Top][All Lists]
Advanced

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

Re: declare -a list=('*') expands quoted '*' during assignment.


From: Chet Ramey
Subject: Re: declare -a list=('*') expands quoted '*' during assignment.
Date: Fri, 20 Feb 2004 14:52:59 -0500
User-agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.6) Gecko/20040113

david.b.james@nissenhut.com wrote:

Configuration Information [Automatically generated, do not change]:
Machine: sparc
OS: solaris2.8
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='sparc' 
-DCONF_OSTYPE='solaris2.8' -DCONF_MACHTYPE='sparc-sun-solaris2.8' 
-DCONF_VENDOR='sun' -DSHELL -DHAVE_CONFIG_H  -I.  -I. -I./include -I./lib 
-I/app/util/include -O2 -g -pipe
uname output: SunOS ln-dist 5.8 Generic_108528-15 sun4u sparc SUNW,Ultra-80
Machine Type: sparc-sun-solaris2.8

Bash Version: 2.05b
Patch Level: 0
Release Status: release

Description:

  Declaring and assigning an array variable using 'declare -a
  name=(...)' expands quoted filename patterns in the array elements
  during the assignment.

  This is unexpected and different from the behaviour of array
  assignment using plain 'list=(...)'. Following execution of the two
  statements below, list1 and list2 would have different contents.

I will take a look at it, but you have to understand that the two are
not the same.  Assignment statements are part of the shell grammar.
The argument to `declare' is, for all intents and purposes, just another
word.  Before declare sees it, it has already been through all of the
shell word expansions, including quote removal.

There is already some trickery there to allow the `()' to pass through
unscathed, so there is some precedent here for treating the arguments
to declare/typeset/local/etc differently (and, in fact, they already do
not undergo word splitting).  However, the two things are, as I said,
different objects.

Chet




reply via email to

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