mirror of
https://github.com/LamGC/quickly-conf-sshd.git
synced 2025-04-30 06:37:35 +00:00
修复 get_param_value 无法搜寻多个参数的问题.
This commit is contained in:
parent
4eb3738352
commit
452c6c8b7a
16
conf-sshd.sh
16
conf-sshd.sh
@ -9,7 +9,7 @@ default_cron="0 0 * * *"
|
|||||||
# 脚本 Url
|
# 脚本 Url
|
||||||
script_url="{{ script_url }}"
|
script_url="{{ script_url }}"
|
||||||
|
|
||||||
########### 脚本区 ###########
|
############ 脚本区 ##########
|
||||||
|
|
||||||
script_params=$@
|
script_params=$@
|
||||||
has_param() {
|
has_param() {
|
||||||
@ -28,15 +28,18 @@ get_param_value() {
|
|||||||
local find=false
|
local find=false
|
||||||
for param in $script_params; do
|
for param in $script_params; do
|
||||||
if [ "$find" == "true" ]; then
|
if [ "$find" == "true" ]; then
|
||||||
echo $param
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
if [ "$param" == "$1" ]; then
|
|
||||||
if [[ $param == -* ]]; then
|
if [[ $param == -* ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
find=true
|
echo $param
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
|
for tParam in $@; do
|
||||||
|
if [ "$tParam" == "$param" ]; then
|
||||||
|
find=true
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,6 +72,7 @@ if [ $(has_param "-h" "--help") == "true" ]; then
|
|||||||
echo "only available when the script is executed as root:"
|
echo "only available when the script is executed as root:"
|
||||||
echo " -n, --no-install-sshd Do not install SSH Server."
|
echo " -n, --no-install-sshd Do not install SSH Server."
|
||||||
echo " -p, --allow-root-passwd <yes | no> Allow Root to log in with a password."
|
echo " -p, --allow-root-passwd <yes | no> Allow Root to log in with a password."
|
||||||
|
echo ""
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user