Reading the Properties File From Shell script

Hi,

I am new to the shell script please I need help for following question.
I have properties file name called "com.test.properties" I have No of key values in this properties.

com.person.name = xyz
com.person.age = 55
com.person.address = hello

I want read this properties but i have other properties also but i want read only
above properties.

I tried in the following way. but it's not working. because key is having .

#!/bin/sh
# Sample shell script to read and act on properties

# source the properties:
. com.test.properties

# Then reference then:
echo $com.person.name;

Please any one know any other way help thanks in advance

Thanks
Venu J

When you want to use them as shell variables in the way you do, you may not use a dot in the variable name, as you already noticed. Also there may be no blanks between the name and the equal sign nor between the equal sign and the value.

Of course you can do something like:

$> VAR="com.person.name = xyz"
$> echo $VAR
com.person.name = xyz

You can also read them into an array as elements, etc.