On Wed, Sep 27, 2017 at 9:10 AM, Martijn Dekker <[email protected]> wrote:
> Op 27-09-17 om 14:44 schreef Greg Wooledge:
> > I'm just going to chalk this up as yet another example of unquoted $*
> > or $@ being Completely Wrong.
>
> Nonsense. This is a bug in bash and it should be fixed, not excused.
> Quoting expansions should never be necessary for assignments.
For what its worth, this behavior appears to have been introduced in bash
4.3:
% cat tmp.bash
set " abc " " def ghi " "jkl "
unset -v IFS var
var=${var-$*}/${var-$*}
printf '[%s]\n' "$var"
% for tag in 3.2 4.0 4.1 4.2 4.3 4.4; do echo "$tag"; docker run -i
bash:$tag bash < tmp.bash; done
3.2
[ abc def ghi jkl / abc def ghi jkl ]
4.0
[ abc def ghi jkl / abc def ghi jkl ]
4.1
[ abc def ghi jkl / abc def ghi jkl ]
4.2
[ abc def ghi jkl / abc def ghi jkl ]
4.3
[abc def ghi jkl/abc def ghi jkl]
4.4
[abc def ghi jkl/abc def ghi jkl]