|
From: | L A Walsh |
Subject: | Re: for loop over parameter expansion of array can miss resulted empty list |
Date: | Tue, 22 Mar 2022 15:24:57 -0700 |
User-agent: | Thunderbird |
On 2022/03/22 13:53, L A Walsh wrote:
On 2022/03/21 03:40, Alex fxmbsw7 Ratchev wrote:i solve this by shopt -s nullglobRepeat-By: Code: x=("/"); for i in "${x[@]%/}"; do echo "i is '$i'"; done Result: none Expected result: i is ''
BTW -- try adding "-u" on your bash line. Then you'll see what is really null vs. containing a ''.
[Prev in Thread] | Current Thread | [Next in Thread] |