Forráskód Böngészése

--port novalue stop

qiaofeng1227 1 éve
szülő
commit
00a45147b6
2 módosított fájl, 47 hozzáadás és 14 törlés
  1. 37 11
      install/install.sh
  2. 10 3
      install/install_cockpit.sh

+ 37 - 11
install/install.sh

@@ -45,27 +45,53 @@ path="/data/websoft9/source"
 while [[ $# -gt 0 ]]; do
 while [[ $# -gt 0 ]]; do
     case $1 in
     case $1 in
         --version)
         --version)
-            version="$2"
-            shift 2
+            shift
+            if [[ $1 == --* ]]; then
+                echo "Missing value for --version"
+                exit 1
+            fi
+            version="$1"
+            shift
             ;;
             ;;
         --port)
         --port)
-            port="$2"
-            shift 2
+            shift
+            if [[ $1 == --* ]]; then
+                echo "Missing value for --port"
+                exit 1
+            fi
+            port="$1"
+            shift
             ;;
             ;;
         --channel)
         --channel)
-            channel="$2"
-            shift 2
+            shift
+            if [[ $1 == --* ]]; then
+                echo "Missing value for --channel"
+                exit 1
+            fi
+            channel="$1"
+            shift
             ;;
             ;;
         --path)
         --path)
-            path="$2"
-            shift 2
+            shift
+            if [[ $1 == --* ]]; then
+                echo "Missing value for --path"
+                exit 1
+            fi
+            path="$1"
+            shift
             ;;
             ;;
         --devto)
         --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
     esac
 done
 done

+ 10 - 3
install/install_cockpit.sh

@@ -30,14 +30,21 @@ export PATH
 
 
 echo -e "\n\n-------- Cockpit --------"
 echo -e "\n\n-------- Cockpit --------"
 
 
+# 获取参数值
 while [[ $# -gt 0 ]]; do
 while [[ $# -gt 0 ]]; do
     case $1 in
     case $1 in
         --port)
         --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
     esac
 done
 done