ZSH for loop array variable issue

It’s actually much simpler than that:

lw=('plugin1' 'plugin2' 'plugin3')

for i in $lw; do
  . ~/Library/Rogall/plugins/$i/lw.prg end
done

In summary:

  • Assign to foo, not $foo (the shell would try to expand $foo and assign to whatever it expands to; typically not useful)
  • Use the loop variable directly; it contains the array value rather than the index

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)