I'm working in zsh, but I'm sure that bash instructions will also be helpful.
I need to have a for loop that goes through the values stored in the array lw and then launches a shell script, based on the name value stored in the array.
So far, this is what I've come up with:
$lw=('plugin1' 'plugin2' 'plugin3') for i in $lw; do . ~/Library/Rogall/plugins/$lw[$i]/lw.prg end; done Running this gives me an error saying that it can't find ~/Library/Rogall/plugins//lw.prg. It appears as if it's ignoring my variable all together.
Any ideas where I've messed up?
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:
foo, not $foo (the shell would try to expand $foo and assign to whatever it expands to; typically not useful)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With