Set configuration file location

This commit is contained in:
Bob Mottram 2016-10-11 13:07:52 +01:00
parent 4a70e40c1c
commit de13d76d65
1 changed files with 13 additions and 8 deletions

View File

@ -126,7 +126,13 @@ function write_config_param {
if [ ${#param_name} -gt 0 ]; then if [ ${#param_name} -gt 0 ]; then
if [ ${#param_value} -gt 0 ]; then if [ ${#param_value} -gt 0 ]; then
if [ $CONFIGURATION_FILE ]; then # set configuration file location if needed
test_config_file="$CONFIGURATION_FILE"
if [ ${#test_config_file} -eq 0 ]; then
$CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
fi
# update the configuration file
if [ -f $CONFIGURATION_FILE ]; then if [ -f $CONFIGURATION_FILE ]; then
if grep -q "${param_name}=" $CONFIGURATION_FILE; then if grep -q "${param_name}=" $CONFIGURATION_FILE; then
sed -i "s|${param_name}=.*|${param_name}=${param_value}|g" $CONFIGURATION_FILE sed -i "s|${param_name}=.*|${param_name}=${param_value}|g" $CONFIGURATION_FILE
@ -138,7 +144,6 @@ function write_config_param {
fi fi
fi fi
fi fi
fi
} }
function save_configuration_values { function save_configuration_values {