From 5d68986caee75f75185f1aae21b37454fe613084 Mon Sep 17 00:00:00 2001 From: Robin Vobruba Date: Thu, 13 Apr 2023 08:26:03 +0200 Subject: [PATCH 1/2] Prevents crash when source-ing with 'set -u' (Unset variables) [fix] --- script/yaml.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/yaml.sh b/script/yaml.sh index cda48d4..418dfda 100755 --- a/script/yaml.sh +++ b/script/yaml.sh @@ -71,6 +71,6 @@ create_variables() { # Execute parse_yaml() direct from command line -if [ "x" != "x${1}" ] && [ "x--debug" != "x${1}" ]; then - parse_yaml "${1}" "${2}" +if [ "x" != "x${1:-}" ] && [ "x--debug" != "x${1:-}" ]; then + parse_yaml "${1}" "${2:-}" fi From 8c2d6ce151a2af5d425c7744e4dcf4cab93a92a5 Mon Sep 17 00:00:00 2001 From: Robin Vobruba Date: Thu, 13 Apr 2023 08:39:58 +0200 Subject: [PATCH 2/2] Prevents crash in main fn with 'set -u' [fix #39] --- script/yaml.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/yaml.sh b/script/yaml.sh index 418dfda..ec5ece5 100755 --- a/script/yaml.sh +++ b/script/yaml.sh @@ -5,7 +5,7 @@ parse_yaml() { local yaml_file=$1 - local prefix=$2 + local prefix=${2:-} local s local w local fs