Path: csiph.com!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: worley@alum.mit.edu (Dale R. Worley) Newsgroups: gnu.bash.bug Subject: Re: No word splitting for assignment-like expressions in compound assignment Date: Mon, 27 Jul 2020 01:31:32 -0400 Lines: 35 Approved: bug-bash@gnu.org Message-ID: References: <6614fa7668daf7f2b450e319a28b624c@ispras.ru> (izbyshev@ispras.ru) <87o8o1zfpn.fsf@hobgoblin.ariadne.com> NNTP-Posting-Host: lists.gnu.org X-Trace: usenet.stanford.edu 1595813516 22258 209.51.188.17 (27 Jul 2020 01:31:56 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: Alexey Izbyshev Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcastmailservice.net; s=20180828_2048; t=1595813506; bh=uD8gi8/7ypbQepH+gLDSBvS8aZhCf1JXmXPa7ogEgpI=; h=Received:Received:Received:Received:From:To:Subject:Date: Message-ID; b=FyH82J6tQbWQRe4ZsJ61tDsZkO+2Psc0NXavT0zRxIATF/WRc2FGxD/5mklu11yo5 S9h94XG0QqkHzSLrxzuvVAkJ0aEYuGbh4czPgjTe0dvej1iJ0x9T6h/KmNXi6htqZE Y5hWmRsMacb2dsDTN+rujyBMThfR2kayziEpjYAUZk2K54Ziv36HRAyky4XG+b5+DV TOlIKBTi+DH2zxQqf2NaO7Q7za6WImgPmx9KkpkjgQZhGunN0Q9YTFtkkA3o7Pq29H 2C9YMRjeiHlekc25GAY09CTLX3dZAmI2+DyxA5gkuayQvJD/syTE0TRXsTH7PeMAKD c7LVMOC+Stmuw== X-Xfinity-VMeta: sc=-100.00;st=legit X-Authentication-Warning: hobgoblin.ariadne.com: worley set sender to worley@alum.mit.edu using -f In-Reply-To: <6614fa7668daf7f2b450e319a28b624c@ispras.ru> (izbyshev@ispras.ru) Received-SPF: softfail client-ip=2001:558:fe21:29:69:252:207:33; envelope-from=worley@alum.mit.edu; helo=resqmta-ch2-01v.sys.comcast.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/26 21:31:46 X-ACL-Warn: Detected OS = ??? 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665, URIBL_BLOCKED=0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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: <87o8o1zfpn.fsf@hobgoblin.ariadne.com> Xref: csiph.com gnu.bash.bug:16619 Alexey Izbyshev writes: > 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. > * 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. Interesting. The documentation for 4.2.53(1) says this about parameter assignments generally, with no special rules for compound assignments: All values undergo tilde expansion, parameter and variable expansion, com- mand substitution, arithmetic expansion, and quote removal (see EXPAN- SION below). ... Word splitting is not performed, with the exception of "$@" as explained below under Special Parameters. Pathname expansion is not performed. So it seems like the word splitting in "A=(X$Z)" is incorrect. So is pathname expansion in that context. Oddly, brace expansion is not mentioned. Dale