|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Environment variable in configuration file
Hi,
I am trying to write a ksh script on Aix needs to read values from a configuration files. I am able to get the fixed value from the configuration file, but I am having a problem getting values using environment variables. for example. in the config file local=${COUNTRY}:mycity in the shell, export COUNTRY=USA in the script, i can read the value for local in only as "${COUNTRY}:mycity", the ${COUNTRY} doesn't get substituted by the environment variable. So far I am doing this in the script. assume local_val stores what the script reads from the configuration file for "local" using "cut". eval temp=\$$local_val print $temp I can get the nnnnnUSA:mycity, here the nnnnn is the pid for the script. I don't know why it is there. I have use ${var#pattern} to remove it. I don't know if there is a nicer and cleaner way to get the value replaced by the environment variable. any ideas? Thanks. -d |
|
#2
|
||||
|
||||
|
Try without \$: Code:
eval temp=$local_val
__________________
|
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Environment variable in configuration file |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|