Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14428

Re: Unquoted array slice ${a[@]:0} expands to just one word if IFS doesn't have a space

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups gnu.bash.bug
Subject Re: Unquoted array slice ${a[@]:0} expands to just one word if IFS doesn't have a space
Date Wed, 1 Aug 2018 08:12:51 -0400
Lines 9
Approved bug-bash@gnu.org
Message-ID <mailman.4539.1533125608.1292.bug-bash@gnu.org> (permalink)
References <c1978119-1836-e88d-4889-c54bea4d0559@iki.fi>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace usenet.stanford.edu 1533125608 1666 208.118.235.17 (1 Aug 2018 12:13:28 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
Mail-Followup-To bug-bash@gnu.org
Content-Disposition inline
In-Reply-To <c1978119-1836-e88d-4889-c54bea4d0559@iki.fi>
User-Agent NeoMutt/20170113 (1.7.2)
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy]
X-Received-From 139.137.100.1
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.21
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash/>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:14428

Show key headers only | View raw


On Wed, Aug 01, 2018 at 02:43:27PM +0300, Ilkka Virta wrote:
> On both Bash 4.4.12(1)-release and 5.0.0(1)-alpha, a subarray slice like
> ${a[@]:0} expands to just one word if unquoted (and if IFS doesn't
> contain a space):

This just reinforces the point that unquoted $@ or $* (or the array
equivalent) is a bug in the script.  It gives unpredictable results.
Don't do it.

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: Unquoted array slice ${a[@]:0} expands to just one word if IFS doesn't have a space Greg Wooledge <wooledg@eeg.ccf.org> - 2018-08-01 08:12 -0400

csiph-web