Command substitution now works inside arithmetic expressions in *bash*
Previously, *bash* did not save input line state across recursive calls to the shell parser, causing the shell to fail to parse command substitution inside arithmetic expressions. For example, the following command failed:
for point in "/boot"; do disk_dir["$( df -P $point | awk '{print $1}' )"]=1; done
This bug has been fixed, *bash* now saves input line state before making recursive calls to the parser, and command substitution now works inside arithmetic expressions.
Description of problem:
Wrong parsing inside for cycle when associative array is used with substitution inside brackets.
How reproducible:
Always with old bash version 4.1.2.
Steps to Reproduce:
$ for point in "/boot"; do disk_dir["$( df -P $point | awk '{print $1}' )"]=1; done
Additional info:
$rpm -q bash
bash-4.1.2-33.el6.x86_64
I can't reproduce it with version 4.3.33 on Fedora 21.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://rhn.redhat.com/errata/RHBA-2016-0800.html
Description of problem: Wrong parsing inside for cycle when associative array is used with substitution inside brackets. How reproducible: Always with old bash version 4.1.2. Steps to Reproduce: $ for point in "/boot"; do disk_dir["$( df -P $point | awk '{print $1}' )"]=1; done Additional info: $rpm -q bash bash-4.1.2-33.el6.x86_64 I can't reproduce it with version 4.3.33 on Fedora 21.