Merge branch 'TinCanTech-set_var-v2'
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
This commit is contained in:
commit
41f23444c6
@ -4740,10 +4740,10 @@ Using SSL: $EASYRSA_OPENSSL $ssl_version
|
|||||||
# the variable when it is already defined (even if currently null)
|
# the variable when it is already defined (even if currently null)
|
||||||
# Sets $1 as the value contained in $2 and exports (may be blank)
|
# Sets $1 as the value contained in $2 and exports (may be blank)
|
||||||
set_var() {
|
set_var() {
|
||||||
var=$1
|
[ "$1" ] || die "set_var - missing input"
|
||||||
shift
|
[ "$1" = "${1% *}" ] || die "set_var - input error"
|
||||||
value="$*"
|
[ "$#" -lt 3 ] || die "set_var - excess input"
|
||||||
eval "export $var=\"\${$var-$value}\""
|
eval "export \"$1\"=\"\${$1-$2}\""
|
||||||
} #=> set_var()
|
} #=> set_var()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user