How to get the array name from the below ?
Getting the name of the array from config :
jobcfgUniqName=`echo ${config_data} | awk -F "#" '{print $3}'`
Creating an array of it :
for ((xx = 0; xx <= ${#joblognameSearch[@]}; xx++))
do
print $joblognameSearch[$xx]
eval ($jobcfgUniqName)[$xx]=`grep -B 3 -i error $joblogPath/$joblognameSearch[$xx]`
print jobcfgUniqName : ${jobcfgUniqName}
done
This line I tried changing many ways but did not work :
eval ($jobcfgUniqName)[$xx]
Add
echo
.Example:
You can use
declare
bulletin of BASH to replace your eval by this:Now you will have dynamic array create with prefix
arr_
and some variable name$jobcfgUniqName
.TESTING: