Anis_Stack
Anis_Stack

Reputation: 3452

SHELL : concatenate variable name

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 ...

Upvotes: 0

Views: 27

Answers (0)

Related Questions