bash script variable inside variable

Posted by user316100 on Stack Overflow See other posts from Stack Overflow or by user316100
Published on 2010-04-14T02:53:39Z Indexed on 2010/04/14 3:03 UTC
Read the original article Hit count: 285

Filed under:
|
|

x=1

c1=string1
c2=string2
c3=string3

echo $c1
string1

I'd like to have the output be string1 by using something like: echo $(c($x))

So later in the script I can increment the value of x and have it output string1, then string2 and string3.

Can anyone point me in the right direction?

© Stack Overflow or respective owner

Related posts about bash

Related posts about variables