bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Spaces trimmed from $* when assigned while IFS is unset [was: Unexpe


From: Clint Hepner
Subject: Re: Spaces trimmed from $* when assigned while IFS is unset [was: Unexpected word splitting on $* ...]
Date: Wed, 27 Sep 2017 10:49:20 -0400

On Wed, Sep 27, 2017 at 9:10 AM, Martijn Dekker <address@hidden> 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]


reply via email to

[Prev in Thread] Current Thread [Next in Thread]