From 8e62fa28d7933459097116900fe7eb1897bc8d8c Mon Sep 17 00:00:00 2001 From: Richard T Bonhomme Date: Mon, 3 Jul 2023 02:04:18 +0100 Subject: [PATCH] set_var(): Allow empty input to return without error Signed-off-by: Richard T Bonhomme --- easyrsa3/easyrsa | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/easyrsa3/easyrsa b/easyrsa3/easyrsa index 5b28e24..590f4a4 100755 --- a/easyrsa3/easyrsa +++ b/easyrsa3/easyrsa @@ -5762,9 +5762,9 @@ Temporary directory does not exist: # the variable when it is already defined (even if currently null) # Sets $1 as the value contained in $2 and exports (may be blank) set_var() { - [ "$1" ] || die "set_var - missing input" - [ "$1" = "${1% *}" ] || die "set_var - input error" + [ "$#" = 0 ] && return [ "$#" -lt 3 ] || die "set_var - excess input" + [ "$1" = "${1% *}" ] || die "set_var - input error" eval "export \"$1\"=\"\${$1-$2}\"" } #=> set_var()