From fce61c6d35515b6f89b50f42ac2cba6b4b60159e Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 29 Oct 2013 16:11:55 +0100 Subject: [PATCH] scripts/utils.sh: add a function for setting a variable default Signed-off-by: Felix Fietkau --- scripts/utils.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/utils.sh b/scripts/utils.sh index 01d8ad5..a5dc782 100644 --- a/scripts/utils.sh +++ b/scripts/utils.sh @@ -13,6 +13,12 @@ add_default_handler() { esac } +set_default() { + local __s_var="$1" + local __s_val="$2" + eval "export -- \"$__s_var=\${$__s_var:-\$__s_val}\"" +} + _config_add_generic() { local type="$1"; shift -- 2.30.2