[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
null array[*] expansion not treated as null
From: |
Grisha Levit |
Subject: |
null array[*] expansion not treated as null |
Date: |
Mon, 12 Nov 2018 16:32:06 -0500 |
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>
- null array[*] expansion not treated as null,
Grisha Levit <=