diff options
author | Felix Fietkau <nbd@openwrt.org> | 2013-10-29 16:11:55 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2013-10-29 16:12:11 +0100 |
commit | fce61c6d35515b6f89b50f42ac2cba6b4b60159e (patch) | |
tree | c4678e87ffc4b58dc57102bc26fe9dc1f2ebfca5 /scripts | |
parent | f80b9e4acc47cf454768b44142495fdb8a68a39f (diff) |
scripts/utils.sh: add a function for setting a variable default
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/utils.sh | 6 |
1 files changed, 6 insertions, 0 deletions
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 |