Re: bash does filename expansion when assigning to array member in compound form

2012-08-29 Thread Chet Ramey
> > > That means you can do things like > > > > > > [{0,1,2,3}]=foo > > > > > > to set the first four elements to the same value This does work, but only in this context. It's a hard sell to say that it should work when using compound assignments and not any other time. I'm inclined to either

Re: bash does filename expansion when assigning to array member in compound form

2012-08-29 Thread Dan Douglas
On Friday, August 24, 2012 09:38:44 AM you wrote: > On 8/22/12 8:58 PM, Chet Ramey wrote: > > > Then how about this: words inside a compound assignment statement that are > > recognized as assignment statements ([1]=foo) are expanded like assignment > > statements (no brace expansion, globbing, or

Re: bash does filename expansion when assigning to array member in compound form

2012-08-24 Thread Chet Ramey
On 8/22/12 8:58 PM, Chet Ramey wrote: > Then how about this: words inside a compound assignment statement that are > recognized as assignment statements ([1]=foo) are expanded like assignment > statements (no brace expansion, globbing, or word splitting). Other words > undergo all the expansions.

Re: bash does filename expansion when assigning to array member in compound form

2012-08-22 Thread Chet Ramey
On 8/20/12 5:12 PM, Dan Douglas wrote: > On Monday, August 20, 2012 07:44:51 PM Roman Rakus wrote: >> And how would you achieve to fill array with all file names containing >> `[1]=' for example. > > $ ls > [1]=a [1]=b > $ ( typeset -a a=( \[1\]=* ); typeset -p a ) > typeset -a a=('[1]=a' '[1]=b

Re: bash does filename expansion when assigning to array member in compound form

2012-08-21 Thread Dan Douglas
On Tuesday, August 21, 2012 07:24:31 AM Stephane Chazelas wrote: > 2012-08-20 19:44:51 +0200, Roman Rakus: > [...] > > And how would you achieve to fill array with all file names > > containing `[1]=' for example. > [...] > > Another interesting question is how to fill the array with all > the fil

Re: bash does filename expansion when assigning to array member in compound form

2012-08-20 Thread Stephane Chazelas
2012-08-20 19:44:51 +0200, Roman Rakus: [...] > And how would you achieve to fill array with all file names > containing `[1]=' for example. [...] Another interesting question is how to fill the array with all the file names that start with a digit followed by "=". $ touch {3..5}=foo $ ls 3=foo

Re: bash does filename expansion when assigning to array member in compound form

2012-08-20 Thread Dan Douglas
On Monday, August 20, 2012 07:44:51 PM Roman Rakus wrote: > And how would you achieve to fill array with all file names containing > `[1]=' for example. $ ls [1]=a [1]=b $ ( typeset -a a=( \[1\]=* ); typeset -p a ) typeset -a a=('[1]=a' '[1]=b') $ ( typeset -a a=( [1]=* ); typeset -p a ) typeset

Re: bash does filename expansion when assigning to array member in compound form

2012-08-20 Thread Roman Rakus
On 08/20/2012 07:12 PM, Gundi Cress wrote: Am Sat, 18 Aug 2012 19:55:17 +0100 schrieb Stephane Chazelas: 2012-08-18 10:26:22 -0500, Dan Douglas: This is a feature that all shells with this style of compound assignment have in common. If no explicit subscripts are given, the text between the pa

Re: bash does filename expansion when assigning to array member in compound form

2012-08-20 Thread Gundi Cress
Am Sat, 18 Aug 2012 19:55:17 +0100 schrieb Stephane Chazelas: > 2012-08-18 10:26:22 -0500, Dan Douglas: >> This is a feature that all shells with this style of compound >> assignment have in common. If no explicit subscripts are given, the >> text between the parentheses is processed exactly as th

Re: bash does filename expansion when assigning to array member in compound form

2012-08-18 Thread Dan Douglas
Bleh I'm wrong, brace expansion remains too. I should know this... it's hard to remember all the quirks even when I write them down.

Re: bash does filename expansion when assigning to array member in compound form

2012-08-18 Thread Dan Douglas
On Saturday, August 18, 2012 07:55:17 PM Stephane Chazelas wrote: > 2012-08-18 10:26:22 -0500, Dan Douglas: > > This is a feature that all shells with this style of compound assignment > > have > > in common. If no explicit subscripts are given, the text between the > > parentheses is processed

Re: bash does filename expansion when assigning to array member in compound form

2012-08-18 Thread Stephane Chazelas
2012-08-18 10:26:22 -0500, Dan Douglas: > This is a feature that all shells with this style of compound assignment have > in common. If no explicit subscripts are given, the text between the > parentheses is processed exactly as though it were arguments to a command > including brace expansion,

Re: bash does filename expansion when assigning to array member in compound form

2012-08-18 Thread Dan Douglas
This is a feature that all shells with this style of compound assignment have in common. If no explicit subscripts are given, the text between the parentheses is processed exactly as though it were arguments to a command including brace expansion, word-splitting, and pathname expansion (and con

bash does filename expansion when assigning to array member in compound form

2012-08-18 Thread Gundi Cress
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 co