solaris ksh read variables from config file
Posted on 2011-09-22
I would like to create a config file dbaccess.cnf with the contents
I would like to be able to read the dbaccess.cnf file contents to create a config file for reading in to a variable in ksh to be placed into a mysql statement that will be used for other tasks. I want to define the variables as
myhost = '<value received from dbaccess.cnf where line starts with "HOST=">'
myuser = '<value received from dbaccess.cnf where line starts with "USER=">'
etc, for each of the values in the config file. Not necessarily limited to the 3 I defined.
What I want is to a sample ksh script that will read the values from the dbaccess.cnf and the the value of the fields defined above.
I can probably take the rest of the scripting from that point. I prefer not to use a temp file.