Add support of '=' char to define value.
This commit is contained in:
parent
7443c41234
commit
5976e4c7bd
|
@ -45,7 +45,7 @@ check_value_in_conf_file () {
|
|||
|
||||
# If multiple expected values
|
||||
local list_search_ok=(${search_ok})
|
||||
local search_ok_to_grep="^[[:space:]]*"${param_key}"[[:space:]]*:\?[[:space:]]*"${search_ok}"[[:space:]]*$"
|
||||
local search_ok_to_grep="^[[:space:]]*"${param_key}"[[:space:]]*:\?=\?[[:space:]]*"${search_ok}"[[:space:]]*$"
|
||||
|
||||
# If there is more than one unexpected values
|
||||
if [ ${#list_search_ok[@]} -gt 1 ]
|
||||
|
@ -54,7 +54,7 @@ check_value_in_conf_file () {
|
|||
for var_search_ok in ${list_search_ok[@]}
|
||||
do
|
||||
|
||||
search_ok_to_grep=${search_ok_to_grep}'-e '"^[[:space:]]*${param_key}[[:space:]]*:\?[[:space:]]*${var_search_ok}[[:space:]]*$"' '
|
||||
search_ok_to_grep=${search_ok_to_grep}'-e '"^[[:space:]]*${param_key}[[:space:]]*:\?=\?[[:space:]]*${var_search_ok}[[:space:]]*$"' '
|
||||
done
|
||||
fi
|
||||
|
||||
|
@ -72,7 +72,7 @@ check_value_in_conf_file () {
|
|||
# Unexpected value is not set
|
||||
else
|
||||
|
||||
search_ok_to_grep="^[[:space:]]*"${param_key}"[[:space:]]*:\?[[:space:]]*"${search_ok}"[[:space:]]*$"
|
||||
search_ok_to_grep="^[[:space:]]*"${param_key}"[[:space:]]*:\?=\?[[:space:]]*"${search_ok}"[[:space:]]*$"
|
||||
|
||||
# Boolean for final Return Code, if one return code in the loop -ne 0 -> set finalRC=1
|
||||
local finalRC=0
|
||||
|
@ -82,7 +82,7 @@ check_value_in_conf_file () {
|
|||
then
|
||||
for var_search_ok in ${list_search_ok[@]}
|
||||
do
|
||||
grep -q "^[[:space:]]*"${param_key}"[[:space:]]*:\?[[:space:]]*"${var_search_ok}"[[:space:]]*$" ${conf_file}
|
||||
grep -q "^[[:space:]]*"${param_key}"[[:space:]]*:\?=\?[[:space:]]*"${var_search_ok}"[[:space:]]*$" ${conf_file}
|
||||
|
||||
RC=${?}
|
||||
|
||||
|
@ -96,7 +96,7 @@ check_value_in_conf_file () {
|
|||
# Else : do classical check
|
||||
else
|
||||
# Check if OK value is set (success if return code = 0)
|
||||
grep -q "^[[:space:]]*"${param_key}"[[:space:]]*:\?[[:space:]]*"${search_ok}"[[:space:]]*$" ${conf_file}
|
||||
grep -q "^[[:space:]]*"${param_key}"[[:space:]]*:\?=\?[[:space:]]*"${search_ok}"[[:space:]]*$" ${conf_file}
|
||||
|
||||
# Return Code
|
||||
finalRC=${?}
|
||||
|
|
Loading…
Reference in a new issue