From 5b4a1626c2efbbc4b46e8995e553ec2c14549904 Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Sun, 13 Jun 2021 16:30:06 -0700 Subject: 49069: literal interpretation of subscripts for unset of array/hash elements --- NEWS | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'NEWS') diff --git a/NEWS b/NEWS index ee97868f9..c12ec3b0e 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,18 @@ Note also the list of incompatibilities in the README file. Changes since 5.8 ----------------- +When unsetting a hash element, the string enclosed in square brackets is +interpreted literally after any normal command-line-argument expansions. +Thus + unset "hash[$key]" +first expands $key as usual for a double-quoted string, and then interprets +that result as the exact hash element to unset. This differs from previous +versions of the shell, which would also remove a leading backslash for an +unusual subset of characters in the expansion of $key. Note this also +means, for example, that + unset 'hash[ab]cd]' +unsets the element with key "ab]cd" rather than silently doing nothing. + The function command learnt a -T option to declare a function and enable tracing for it simultaneously. -- cgit 1.4.1