bug-bash
[Top][All Lists]
Advanced

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

bash does filename expansion when assigning to array member in compound


From: Gundi Cress
Subject: bash does filename expansion when assigning to array member in compound form
Date: 18 Aug 2012 10:48:53 GMT
User-agent: Pan/0.136 (I'm far too busy being delicious; GIT 926a150 git://git.gnome.org/pan2)

This is a question about bash's behaviour concerning assignment to array 
members.

Bash Version 4.2.24(1)-release (x86_64-pc-linux-gnu)

The bash manual (version 4.1, chapter 3.4) says about assignment
to shell variables: "Filename expansion is not performed."


simple test to proof this on the command line:

  $ varx=*.*; echo "$varx"
  => *.*

This is true also for assignment to array members.

  $ vary[0]=*.*; echo "${vary[0]}"
  => *.*

But when compound form of asignment is used, filename expansion _IS_
performed.

  $ varz=(*.*); echo "${varz[0]}"
  => file1.abc file2.xyz

If this is a feature, I can't find any documentation.

Is this a bug?

Thank you for your help

Gundi




reply via email to

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