I need to read a variable in shell script and using that variable to perform some operation. For e.g. I am reading variable markets from config and using this variable to find out the value of another variable redis_host_silver_$j
command used :-
for j in `echo $markets | awk -F"," '{ for(i=1; i<=NF; ++i) print $i }'`;
do
echo $(redis_host_silver_$j);
done
Can anyone help me in this?
echo $markets | awk -F"," '\''{ for(i=1; i<=NF; ++i) print $i }'\''' ++ redis_host_silver_uk test.sh: line 61: redis_host_silver_uk: command not foundecho "redis_host_silver_$j";evalmight be needed... You probably want arrays though... Also$(stuff)will runstuffand replace in the result. (a=1;$(stuff_$a)will runstuff_1)