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


Groups > gnu.bash.bug > #14474

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

From Bize Ma <binaryzebra@gmail.com>
Newsgroups gnu.bash.bug
Subject Assignment of $* to a var removes spaces on unset IFS.
Date 2018-08-13 11:51 -0400
Message-ID <mailman.5062.1534175473.1292.bug-bash@gnu.org> (permalink)

Show all headers | View raw


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.

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web