SHELL : concatenate variable name

34 Views Asked by At

I would like to concatenate the variable name with shell using the folowing example

val=23
    for i in 1 2 3 4 
    do   
    a$i=$val + $i 
    done

but I got error -ash: a1=x: not found !!

how can I concatenate variable name with shell

the purpose is to get a1=24; a2=25 ...

0

There are 0 best solutions below