Re: Global variable modification by nameref chain
On Sun, Jun 12, 2016 at 8:33 PM, Chet Ramey wrote: > 3. Honor the assignment and delete the nameref variable, creating a new >one, like bash-4.3: > > $ ../bash-4.3-patched/bash ./x1 > declare -n a="b" > declare -n b="a[1]" > declare -a a='([1]="foo")' > declare -n b="a[1]" I kind of like this option because it's consistent with `typeset -n` meaning "operate directly on the ref variable", and declare together with assignment meaning "redefine the variable" in most cases. I'm not so sure a warning is needed since replacing the variable with a new definition would be the usual thing to do with any other attributes, and the identifier literals used within one scope should be under control.
Multi-line, double quoted string triggers history expansion on subsequent single-quoted commands it gets piped to
Hello, This is my system: $ bash --version GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu) $ uname -a Linux PCNTEJERO 3.19.0-51-generic #58~14.04.1-Ubuntu SMP Fri Feb 26 22:02:58 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux ntejero@PCNTEJERO: ~ $ cat /etc/*ease DISTRIB_ID=LinuxMint DISTRIB_RELEASE=17.3 DISTRIB_CODENAME=rosa DISTRIB_DESCRIPTION="Linux Mint 17.3 Rosa" NAME="Ubuntu" VERSION="14.04.4 LTS, Trusty Tahr" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 14.04.4 LTS" VERSION_ID="14.04" HOME_URL="http://www.ubuntu.com/"; SUPPORT_URL="http://help.ubuntu.com/"; BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"; cat: /etc/upstream-release: Is a directory Bash was installed through "apt-get install --only-upgrade bash" The bug: When printing a multi-line string and piping to another command that uses single-quotes, Bash tries to perform history expansion: echo "9 > 10 > 9 > 11" | awk '!seen[$0]++' bash: !seen[$0]++': event not found > $ echo "9 > 10 > 11" | echo '!a' bash: !a': event not found > Turning history off solves it, but anyway history expansion should not occur within single-quotes. This does not happen in single lines: $ printf "23\n24\n25" | echo '!a' !a Néstor