Modify the method to check whether the value is a function
This commit is contained in:
parent
6cfc7c233a
commit
df878aea3b
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue