i have an array of zeros
declare -a MY_ARRAY=( $(for i in {1..100}; do echo 0; done) )
how to set, for example, 12-25th to "1"? i've tried:
MY_ARRAY[12..25]=1
MY_ARRAY[12:25]=1
MY_ARRAY[12-25]=1
all not working..
the range 12-25 will be variables obtain from another file. I am looking for a simple solution better not involve in looping
please help
( ... )the index numbering starts in 0, unless you specify the index. e.g.( [3]="hello" ). Therefore the 12th element in yourMY_ARRAYis${MY_ARRAY[11]}.