From e08c12e1b191de2150ab120abeb9e5419b157ac1 Mon Sep 17 00:00:00 2001 From: Zhong Lufan Date: Mon, 12 Jul 2021 18:05:00 +0800 Subject: [PATCH] Support separate as script execution --- AliyunOpenApiSDK.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/AliyunOpenApiSDK.sh b/AliyunOpenApiSDK.sh index afea6e5..937e8fc 100644 --- a/AliyunOpenApiSDK.sh +++ b/AliyunOpenApiSDK.sh @@ -1,5 +1,4 @@ -#!/bin/false -# shellcheck shell=bash +#!/bin/bash for _command in openssl curl; do if ! command -v $_command &> /dev/null; then @@ -26,7 +25,7 @@ aliapi_rpc() { return 62 fi - if [[ $# -lt 6 ]];then + if ! [[ $# -eq 4 || $# -eq 6 ]];then echo "Aliyun OpenAPI SDK: aliapi_rpc() not enough parameters" return 66 fi @@ -106,3 +105,5 @@ _urlencode() { result=$(curl -G -s -o /dev/null -w "%{url_effective}" -m 1 --data-urlencode "=$1" http://127.0.0.1:99999) echo "${result#*\?}" } + +[[ $# -ne 0 ]] && aliapi_rpc "$@"