summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAaron Ball <nullspoon@oper.io>2017-06-26 19:50:06 -0600
committerAaron Ball <nullspoon@oper.io>2017-06-26 19:50:06 -0600
commite1bc223978c81066f3e3bb1d11d9a1a7d5bf9a22 (patch)
treefb85477f1ffea1353de10bf968bbd526abaa28ec /lib
parentf7c43650c0942ee69851213e6e8dc296da23585e (diff)
downloadportimg-e1bc223978c81066f3e3bb1d11d9a1a7d5bf9a22.tar.gz
portimg-e1bc223978c81066f3e3bb1d11d9a1a7d5bf9a22.tar.xz
libtemplate:Fixed unbound variable error
When checking an unset variable with bash nounset, a default value must be provided, otherwise an unbound variable error will result. This sets the default value to empty for _varname when checking if empty.
Diffstat (limited to 'lib')
-rw-r--r--lib/template.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/template.sh b/lib/template.sh
index ae1dde5..8cbdbfa 100644
--- a/lib/template.sh
+++ b/lib/template.sh
@@ -57,7 +57,7 @@ function template {
_varname="${_varstr:3:-3}"
# Skip any unset but referenced variables
- if [ -z "${!_varname}" ]; then
+ if [ -z "${!_varname:-}" ]; then
printf \
"WARN: Template variable '%s' is referenced but is unset.\n" \
${_varname} >&2

Generated by cgit