My shell script samplescript.sh resided in the directory /home/projects/sampleproject/scripts and in the shell script I included a configuration file relatively as below:
#!/bin/bash CONF="../config/common.conf" . $CONF
I had written few shell scripts for a project. All these scripts were using some common configuration parameters so I decided to put them in a common file and include it in the scripts file so that when I move the script files from the development to the production environment, I have to change the values in only one file.
My configuration file “config.conf” contained variables like:
DB_HOST=127.0.0.1 DB_PORT=3306 DB_USER=testuser DB_PASS=test123