mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
initscript fkt: ignore blank lines in readhash
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org> Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
committed by
Michael Tremer
parent
96bb3ba8b8
commit
59e3c2a217
@@ -899,6 +899,12 @@ readhash() {
|
||||
|
||||
local line
|
||||
while read -r line; do
|
||||
|
||||
# Skip Blank Lines
|
||||
if [[ ${line} =~ ^[[:space:]]*$ ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
local key="${line%=*}"
|
||||
local val="${line#*=}"
|
||||
|
||||
|
||||
@@ -14,3 +14,6 @@ readhash "CONFIG" "${SCRIPT_PATH}/data/1"
|
||||
# test if we read the correct data
|
||||
test_value_in_array "CONFIG" "RED_DHCP_HOSTNAME" "ipfire"
|
||||
test_value_in_array "CONFIG" "BLUE_MACADDR" "bc:30:7d:58:6b:e3"
|
||||
|
||||
test_that_output_is "${SCRIPT_PATH}/data/1_output_stdout" "1" readhash "CONFIG" "${SCRIPT_PATH}/data/1"
|
||||
test_that_output_is "${SCRIPT_PATH}/data/1_output_stderr" "2" readhash "CONFIG" "${SCRIPT_PATH}/data/1"
|
||||
|
||||
Reference in New Issue
Block a user