From 0fb73d07d24154b8a3b14c54faf164a5e5e92a2f Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Tue, 12 Mar 2019 11:47:04 -0400 Subject: 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. --- (limited to 'lib/control.sh') 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. -- cgit v0.9.1