Hi,
I'm trying to use a config file to define frequencies for checking log files. If the config file contains a frequency it will be used else a default value. The format of the config file (and hence the environment variable) is
FREQ_log_logname=value
A test shell script as below:
FREQ_log_aaa="DAILY"
FREQ_log_bbb="WEEKLY"
FREQ_log_ccc="DAILY"
for i in aaa bbb ccc
do
logfreq="$FREQ_log_$i"
echo "$logfreq";
done
outputs:
aaa
bbb
ccc
rather than the desired:
DAILY
WEEKLY
DAILY
I've spent the last hour trying eval but get the same or bad substitution errors. Does anybody know how to do this ? Thanks.