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


Groups > gnu.bash.bug > #14805

null array[*] expansion not treated as null

From Grisha Levit <grishalevit@gmail.com>
Newsgroups gnu.bash.bug
Subject null array[*] expansion not treated as null
Date 2018-11-12 16:32 -0500
Message-ID <mailman.3945.1542058363.1284.bug-bash@gnu.org> (permalink)

Show all headers | View raw


When an array A has non-zero elements but the expansion of "${A[*]}" is
still
a null string, it is not treated as such for purposes of ${var:-X} expansion
(though $* is treated as null in the same circumstance).

    $ A=(''); set -- ''
    $ echo "<${A[*]:-X}>" "<${*:-X}>"
    <> <X>

    $ IFS=
    $ A=('' ''); set -- '' ''
    $ echo "<${A[*]:-X}>" "<${*:-X}>"
    <> <X>

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


Thread

null array[*] expansion not treated as null Grisha Levit <grishalevit@gmail.com> - 2018-11-12 16:32 -0500

csiph-web