Alex fxmbsw7 Ratchev ([email protected]) wrote:
> bash-5.1# cat int.fail
> int() {
> declare -a int
You've declared a local array named "int" which has nothing in it.
This is inside a function named "int".
> declare i=-1 now
>
> while [[ -v int[++i] ]] && now=${int[i]} ; do
> printf %s\\n "$now"
> done
> }
You're iterating on the empty local array.
>
> int=( a b c )
> int
You also have a global array named "int".
I suggest that you use different names for your stuff. This will help
you avoid a lot of problems. Having a global variable, a local variable,
and a function all sharing the same name (and a name which is actively
*misleading* given that one of the arrays does not, in fact, contain
integer values) is not helping you.