Modify the method to check whether the value is a function

This commit is contained in:
Zhong Lufan 2021-04-18 16:34:28 +08:00
parent 6cfc7c233a
commit df878aea3b
No known key found for this signature in database
GPG Key ID: 373C08F7FFF84D26
1 changed files with 1 additions and 1 deletions

View File

@ -67,7 +67,7 @@ aliapi_rpc() {
_key=${_ali_key[$i]}
_value=${_ali_value[$i]}
# 参数值如果是以 () 结束,代表需要执行函数获取值,如果函数不存在,使用原始值。
[[ ($(grep -E "^.+\(\)$" <<< "$_value") == "$_value" && $(type -t "${_value//()/}") == "function") ]] && _value=$(${_value//()/})
[[ (${_value%()} == "${_value:0:-2}" && $(type -t "${_value:0:-2}") == "function") ]] && _value=$(${_value:0:-2})
_value=$(_urlencode "$_value")
_query_str+="$_key=$_value&"
done