From 00a45147b60b7b66ad34ebe9e50027fc509e134e Mon Sep 17 00:00:00 2001 From: qiaofeng1227 <76487013@qq.com> Date: Fri, 24 Nov 2023 14:57:27 +0800 Subject: [PATCH] --port novalue stop --- install/install.sh | 48 +++++++++++++++++++++++++++++--------- install/install_cockpit.sh | 13 ++++++++--- 2 files changed, 47 insertions(+), 14 deletions(-) diff --git a/install/install.sh b/install/install.sh index 4a9079fc..dca0e77f 100644 --- a/install/install.sh +++ b/install/install.sh @@ -45,27 +45,53 @@ path="/data/websoft9/source" while [[ $# -gt 0 ]]; do case $1 in --version) - version="$2" - shift 2 + shift + if [[ $1 == --* ]]; then + echo "Missing value for --version" + exit 1 + fi + version="$1" + shift ;; --port) - port="$2" - shift 2 + shift + if [[ $1 == --* ]]; then + echo "Missing value for --port" + exit 1 + fi + port="$1" + shift ;; --channel) - channel="$2" - shift 2 + shift + if [[ $1 == --* ]]; then + echo "Missing value for --channel" + exit 1 + fi + channel="$1" + shift ;; --path) - path="$2" - shift 2 + shift + if [[ $1 == --* ]]; then + echo "Missing value for --path" + exit 1 + fi + path="$1" + shift ;; --devto) - devto="$2" - shift 2 + shift + if [[ $1 == --* ]]; then + echo "Missing value for --devto" + exit 1 + fi + devto="$1" + shift ;; *) - shift + echo "Unknown parameter: $1" + exit 1 ;; esac done diff --git a/install/install_cockpit.sh b/install/install_cockpit.sh index 232541e3..58df1af6 100644 --- a/install/install_cockpit.sh +++ b/install/install_cockpit.sh @@ -30,14 +30,21 @@ export PATH echo -e "\n\n-------- Cockpit --------" +# 获取参数值 while [[ $# -gt 0 ]]; do case $1 in --port) - port="$2" - shift 2 + shift + if [[ $1 == --* ]]; then + echo "Missing value for --port" + exit 1 + fi + port="$1" + shift ;; *) - shift + echo "Unknown parameter: $1" + exit 1 ;; esac done