New ZSH user here writing his .zshrc file, which uses GNU find and a for loop to source shell scripts in ~/.aliases that set up my shell aliases. I just spent over an hour on the internet and trying various things wondering why this code worked in BASH, but not in ZSH:
$ for aliases in $(find ~/.aliases -maxdepth 1 -name "*_aliases"); source $aliases
aliases: attempt to set slice of associative array
Over an hour later, I happened to re-write that code with a different variable name:
$ for files in $(find ~/.aliases -maxdepth 1 -name "*_aliases"); source $files
and it worked.
How is ZSH treating this code differently than BASH and why? Are there any advantages?