#!/bin/bash
set -x
array_counter=0
array_value=1
array=(0 0 0)
for number in ${array[@]}
do
array[$array_counter]=\"$array_value\"
array_counter=$(($array_co
Bash seems perfectly happy with variables as array indexes:
$ array=(a b c)
$ arrayindex=2
$ echo ${array[$arrayindex]}
c
$ array[$arrayindex]=MONKEY
$ echo ${array[$arrayindex]}
MONKEY
Your example actually works.
echo ${array[@]}
confirms this.
You might try more efficient way of incrementing your index:
((array_counter++))