When executing the following Bash function, the command substitution does work, but variable assignment fails and the shell interprets the NEW_ADDRESS$n= as a command instead, throwing off "Command not found" errors.
The aim of the code is to have X number of NEW_ADDRESS$n variables assigned with the output of the "printf $line | base58 -c" command, which takes a file containing multiple lines of hex bytes. How do I make this work?
generate_addresses() {
hex_input=$1
n=1
while read -r line; do
NEW_ADDRESS$n=$( printf $line | base58 -c )
n=$((n+1))
done < $hex_input
}
generate_addresses $1