Artificial intelligent assistant

Error setting variable to the length of an array in bash I have the snippet below in a larger script to basically take my balances out of ledger into two arrays so I can print them the way I want to view them. #!/bin/bash assets=("assets:checking" "assets:google wallet" "assets:savings" "assets:cash") assets-bal=() num=${#assets[@]} for $i in {0..${num}} do read -a tmp <<< `ledger -f finances balance "${assets[${i}]}"` assets-bal[${i}]=tmp[0] echo "${assets[${i}]} ${assets-bal[${i}]}" done Every time I try runnning the script I get the error: syntax error near unexpected token `num=${#assets[@]}' `num=${#assets[@]}' From my searching, there should be nothing wrong with that line and I just keep coming up empty trying to find a reason why it won't work. Can anybody point out where I'm wrong?

The problem is probably


assets-bal=()


Variable names must not contain a dash. You are limited to underscores.

I don't know how `bash` interprets `assets-bal=()` but it considers that an incomplete command which has to be finished on another line. Just run that line in a shell to see what I mean.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 0db3b09cd51bce29cb2d60a52c1f1dc1