Websoft9 / websoft9

Applications self-hosting platform for running open source, web-based linux Panel of lite PaaS
https://www.websoft9.com
Other
1.97k stars 296 forks source link

install.sh script will handler when --port have not value #415

Closed chendelin1982 closed 9 months ago

chendelin1982 commented 9 months ago

Describe the bug

all parameter, e.g --port --channel... if have not includes value, the script will handler

root@iZbp11edbd7z9dli762armZ:~# wget -O install.sh https://websoft9.github.io/websoft9/install/install.sh && bash install.sh --port
--2023-11-24 10:31:02--  https://websoft9.github.io/websoft9/install/install.sh
Resolving websoft9.github.io (websoft9.github.io)... 185.199.108.153, 185.199.111.153, 185.199.110.153, ...
Connecting to websoft9.github.io (websoft9.github.io)|185.199.108.153|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12411 (12K) [application/x-sh]
Saving to: ‘install.sh’

install.sh                                        100%[==========================================================================================================>]  12.12K  2.05KB/s    in 5.9s

2023-11-24 10:31:10 (2.05 KB/s) - ‘install.sh’ saved [12411/12411]

handler here

related script

qiaofeng1227 commented 9 months ago
# 获取参数值
while [[ $# -gt 0 ]]; do
    case $1 in
        --version)
            shift
            if [[ $1 == --* ]]; then
                echo "Missing value for --version"
                exit 1
            fi
            version="$1"
            shift
            ;;
        --port)
            shift
            if [[ $1 == --* ]]; then
                echo "Missing value for --port"
                exit 1
            fi
            port="$1"
            shift
            ;;
        --channel)
            shift
            if [[ $1 == --* ]]; then
                echo "Missing value for --channel"
                exit 1
            fi
            channel="$1"
            shift
            ;;
        --path)
            shift
            if [[ $1 == --* ]]; then
                echo "Missing value for --path"
                exit 1
            fi
            path="$1"
            shift
            ;;
        --devto)
            shift
            if [[ $1 == --* ]]; then
                echo "Missing value for --devto"
                exit 1
            fi
            devto="$1"
            shift
            ;;
        *)
            echo "Unknown parameter: $1"
            exit 1
            ;;
    esac
done