#!/bin/bash # 当运行时, 可以传入额外的参数 ## ./runParams.sh [-h] [-c] [--remove] [-p proxy] [-f] [--version vx.y.z] [-l file] Help(){ cat - 1>& 2 << EOF ./install-release.sh [-h] [-c] [--remove] [-p proxy] [-f] [--version vx.y.z] [-l file] -h, --help Show help -p, --proxy To download through a proxy server, use -p socks5://127.0.0.1:1080 or -p http://127.0.0.1:3128 etc -f, --force Force install --version Install a particular version, use --version v3.15 -l, --local Install from a local file --remove Remove installed V2Ray -c, --check Check for update EOF } ######################### while [[ $# > 0 ]]; do case "$1" in -p|--proxy) PROXY="-x ${2}" shift # past argument ;; -h|--help) HELP="1" ;; -f|--force) FORCE="1" ;; -c|--check) CHECK="1" ;; --remove) REMOVE="1" ;; --version) VERSION="$2" shift ;; --extract) VSRC_ROOT="$2" shift ;; --extractonly) EXTRACT_ONLY="1" ;; -l|--local) LOCAL="$2" LOCAL_INSTALL="1" shift ;; --source) DIST_SRC="$2" shift ;; --errifuptodate) ERROR_IF_UPTODATE="1" ;; *) # unknown option ;; esac shift # past argument or value done