[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: for loop over parameter expansion of array can miss resulted empty l
From: |
Lawrence Velázquez |
Subject: |
Re: for loop over parameter expansion of array can miss resulted empty list |
Date: |
Mon, 21 Mar 2022 14:47:12 -0400 |
User-agent: |
Cyrus-JMAP/3.5.0-alpha0-4907-g25ce6f34a9-fm-20220311.001-g25ce6f34 |
On Mon, Mar 21, 2022, at 8:50 AM, Alexey via Bug reports for the GNU Bourne
Again SHell wrote:
> I can add one more example, which change array size while it's not
> expected behavior:
> x=("/"); y=("${x[@]%/}"); echo "x size: ${#x[@]}, y size: ${#y[@]}"
This discrepancy seems to have been introduced some ways back.
<larryv> 3# echo "$BASH_VERSION"; x=("/"); y=("${x[@]%/}"); echo "x ${#x[@]}, y
${#y[@]}"
<shbot> 3.2.48(1)-release
<shbot> x 1, y 1
<larryv> 42# echo "$BASH_VERSION"; x=("/"); y=("${x[@]%/}"); echo "x ${#x[@]},
y ${#y[@]}"
<shbot> 4.2.45(1)-release
<shbot> x 1, y 0
--
vq
Re: for loop over parameter expansion of array can miss resulted empty list, L A Walsh, 2022/03/22
Re: for loop over parameter expansion of array can miss resulted empty list, L A Walsh, 2022/03/22
Re: for loop over parameter expansion of array can miss resulted empty list, Chet Ramey, 2022/03/24