doesnt interate the array anymore, what am i doing wrong
From:
Alex fxmbsw7 Ratchev
Subject:
doesnt interate the array anymore, what am i doing wrong
Date:
Mon, 8 Mar 2021 00:45:53 +0100
i usually interate thru indexed arrays as, i=-1, while [[ -v arr[++i] ]],
but it suddenly stopped
maybe cause i switched to in-functions than aliases use
bash-5.1# cat int.fail
int() {
declare -a int
declare i=-1 now
while [[ -v int[++i] ]] && now=${int[i]} ; do
printf %s\\n "$now"
done
}
int=( a b c )
int
bash-5.1# bash int.fail
bash-5.1#
again it used to work this way, just maybe with functions not
is it a a bash bug ? is it my bug ?