Path: csiph.com!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Alexey Izbyshev Newsgroups: gnu.bash.bug Subject: No word splitting for assignment-like expressions in compound assignment Date: Fri, 24 Jul 2020 03:11:16 +0300 Lines: 31 Approved: bug-bash@gnu.org Message-ID: References: <6614fa7668daf7f2b450e319a28b624c@ispras.ru> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Trace: usenet.stanford.edu 1595552364 23068 209.51.188.17 (24 Jul 2020 00:59:24 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-bash@gnu.org Envelope-to: bug-bash@gnu.org User-Agent: Roundcube Webmail/1.4.4 X-Sender: izbyshev@ispras.ru Received-SPF: pass client-ip=83.149.199.84; envelope-from=izbyshev@ispras.ru; helo=mail.ispras.ru X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/23 20:11:17 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 23 Jul 2020 20:59:23 -0400 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <6614fa7668daf7f2b450e319a28b624c@ispras.ru> Xref: csiph.com gnu.bash.bug:16610 Hello! I have a question about the following behavior: $ Z='a b' $ A=(X=$Z) $ declare -p A declare -a A=([0]="X=a b") $ A=(X$Z) $ declare -p A declare -a A=([0]="Xa" [1]="b") I find it surprising that no word splitting is performed in the first compound assignment. I realize that skipping word splitting may be desirable if a subscript is given (e.g. "A=([0]=$Z)") to make it consistent with normal variable assignment[1], but in this case it looks like a bug. I've reproduced the described behavior on bash 4.4.20 (Ubuntu 18.04), 3.1.17 (CentOS 5) and self-built 5.1-alpha release. Some other discoveries: * Brace expansion is performed for "A=(X=a{x,y}b)" by all bash versions mentioned above (which is inconsistent with normal variable assignment). * Globbing for "A=(X=a?b)" is performed by bash 3.1.17, but not by other versions. [1] https://lists.gnu.org/archive/html/bug-bash/2012-08/msg00055.html Alexey