summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2019-03-12 11:47:04 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2019-03-12 11:47:04 (EDT)
commit0fb73d07d24154b8a3b14c54faf164a5e5e92a2f (patch)
tree92012d9deddd3a758d43e4509b753189dfb9f302 /lib
parentb7b7cb3fdead627c55e3cb9d346a719b5da6842d (diff)
ob_set_substvar(): Make validation more immediately clear
The original version in 000a27ff used a "${parameter:-word}" default value expansion to detect an empty string. Instead, let the case construct match empty strings directly.
Diffstat (limited to 'lib')
-rw-r--r--lib/control.sh6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/control.sh b/lib/control.sh
index a20ea3c..439f52a 100644
--- a/lib/control.sh
+++ b/lib/control.sh
@@ -208,10 +208,8 @@ ob_set_substvar()
# Convert variable name to uppercase and validate.
name="$(echo "${name}" | tr 'a-z-' 'A-Z_')"
- case "${name:- }" in
- *[!A-Z0-9_]*)
- return 125
- ;;
+ case "${name}" in *[!A-Z0-9_]* | '')
+ return 125
esac
# Trim leading and trailing whitespace from value.