From: Felix Fietkau Date: Tue, 29 Oct 2013 15:11:55 +0000 (+0100) Subject: scripts/utils.sh: add a function for setting a variable default X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=fce61c6d35515b6f89b50f42ac2cba6b4b60159e;p=oweals%2Fnetifd.git scripts/utils.sh: add a function for setting a variable default Signed-off-by: Felix Fietkau --- 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