Shell Variable - Please help

Hello all,

How can i access the value of variable within a variable?
Please go through the following code:

count=0
newstr=aaaa${count}
echo "enter value : "
read $newstr <---- Suppose the value entered by the user is "home"
echo $newstr <---- This will print "aaaa0"
echo ${$newstr} <---- doesnt work :confused:

How can I get the value "home" using the newstr variable?

Thanks.

use read with the variable

read newstr and not read $newstr

I think u ve misunderstood it. If I use : read newstr, then the data wont be stored in "aaaa$count".

If it is to be stored in aaaa0, I think you would be better off maintaining a ksh array.

#! /usr/bin/ksh

count=0
newstr=aaaa${count}
echo $newstr
echo "enter value : "
read `echo $newstr`
echo $aaaa0

exit 0

now newstr would contain aaaa0
and aaaa0 would contain the data that is read
with echo $aaaa0 check that ...