Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14474 > unrolled thread

Assignment of $* to a var removes spaces on unset IFS.

Started byBize Ma <binaryzebra@gmail.com>
First post2018-08-13 11:51 -0400
Last post2018-08-13 11:51 -0400
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug


Contents

  Assignment of $* to a var removes spaces on unset IFS. Bize Ma <binaryzebra@gmail.com> - 2018-08-13 11:51 -0400

#14474 — Assignment of $* to a var removes spaces on unset IFS.

FromBize Ma <binaryzebra@gmail.com>
Date2018-08-13 11:51 -0400
SubjectAssignment of $* to a var removes spaces on unset IFS.
Message-ID<mailman.5062.1534175473.1292.bug-bash@gnu.org>
Executing this code:

    set -- "  foo  "    "  bar  baz  "  "  quux  "
    unset IFS
    a=$*
    b="$*"
    printf '[%s]' "$a" "$b"; echo

Leads to this results in several shells:

ash             : [  foo     bar  baz     quux  ][  foo     bar  baz
quux  ]
dash            : [  foo     bar  baz     quux  ][  foo     bar  baz
quux  ]
b205sh          : [  foo     bar  baz     quux  ][  foo     bar  baz
quux  ]
b30sh           : [  foo     bar  baz     quux  ][  foo     bar  baz
quux  ]
b32sh           : [  foo     bar  baz     quux  ][  foo     bar  baz
quux  ]
b41sh           : [  foo     bar  baz     quux  ][  foo     bar  baz
quux  ]
b42sh           : [  foo     bar  baz     quux  ][  foo     bar  baz
quux  ]
b43sh           : [foo bar baz quux][  foo     bar  baz     quux  ]
b44sh           : [foo bar baz quux][  foo     bar  baz     quux  ]
bash            : [foo bar baz quux][  foo     bar  baz     quux  ]
posixbash       : [foo bar baz quux][  foo     bar  baz     quux  ]
lksh            : [  foo     bar  baz     quux  ][  foo     bar  baz
quux  ]
mksh            : [  foo     bar  baz     quux  ][  foo     bar  baz
quux  ]
ksh93           : [  foo     bar  baz     quux  ][  foo     bar  baz
quux  ]
attsh           : [  foo     bar  baz     quux  ][  foo     bar  baz
quux  ]
zsh             : [  foo     bar  baz     quux  ][  foo     bar  baz
quux  ]


Bash since 4.3 fails to follow what the documentation describes as that on
an assignment
values do not undergo splitting or globing.

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web