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