bug-bash
[Top][All Lists]
Advanced

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

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


From: Dan Douglas
Subject: Re: bash does filename expansion when assigning to array member in compound form
Date: Sat, 18 Aug 2012 10:26:22 -0500
User-agent: KMail/4.8.3 (Linux/3.4.6-pf+; KDE/4.8.3; x86_64; ; )

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 
consequently, quoting is just as important). This is an important feature 
because it allows storing the results of a glob in an array easily.

If a subscript is given explicitly, then the right-hand side of the assignment 
is treated exactly as an ordinary scalar assignment would be, including all 
analagous behaviors for `+=' and the integer attribute.

 $ set -x; a=( [1]=* )
+ a=([1]=*)
-- 
Dan Douglas



reply via email to

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