I have a user defined configuration file, which could contain the following type of entries:
directory_001=/a/directory/structure
pattern_001=fred*
pattern_002=*
I have a script which reads the file generically which will loop round
loop 1
genvar=”directory”
iteration=”001”
eval varcontents=”\$genvar”_”$iteration”
expected results varcontents=/a/directory/structure
loop 2
genvar=”pattern”
iteration=”001”
eval varcontents=”\$genvar”_”$iteration”
expected results varcontents=”fred*”
The above appears to work fine, however, the problem arises with loop 3
loop3
genvar=”pattern”
iteration=”002”
eval varcontents=”\$genvar”_”$iteration”
expected results varcontents=”*”
actual results are an error pattern_002: parameter not set
I realise what is happening and can resolve the problem by using pattern_002=\* in the config file. The problem is that the file is user created and it may be that someone will forget the backslash before the *.
Can someone suggest a way to resolve this so that a * without a backslash can be used in the configuration file please?
Many thanks for your help,
Helen