给查询和删除增加空判断
This commit is contained in:
parent
3e26629bc6
commit
778fb6ec59
@ -17,22 +17,13 @@ fi
|
||||
|
||||
case $pick in
|
||||
'1')
|
||||
echo "该系统安装了以下脚本"
|
||||
for i in "$path"/* ; do
|
||||
if [[ $i == "${path}/*" ]];then
|
||||
echo "该地址不存在脚本"
|
||||
fi
|
||||
basename $i
|
||||
done
|
||||
;;
|
||||
'2')
|
||||
declare -a script_arr
|
||||
declare script_name
|
||||
declare script_number=0
|
||||
for i in "$path"/* ; do
|
||||
if [[ $i == "${path}/*" ]];then
|
||||
echo "该地址不存在脚本"
|
||||
exit
|
||||
exit
|
||||
fi
|
||||
script_name=$(awk -F '.' '{print $1}' <<< "$(basename $i)")
|
||||
if [[ $script_name == "linuxtool" ]]; then
|
||||
@ -42,9 +33,35 @@ case $pick in
|
||||
echo "${script_number}.${script_name}"
|
||||
script_arr[$script_number]=$script_name
|
||||
done
|
||||
if [ ${#script_arr[@]} == 0 ]; then
|
||||
echo "该地址不存在脚本"
|
||||
exit
|
||||
fi
|
||||
;;
|
||||
'2')
|
||||
declare -a script_arr
|
||||
declare script_name
|
||||
declare script_number=0
|
||||
for i in "$path"/* ; do
|
||||
if [[ $i == "${path}/*" ]];then
|
||||
echo "该地址不存在脚本"
|
||||
exit
|
||||
fi
|
||||
script_name=$(awk -F '.' '{print $1}' <<< "$(basename $i)")
|
||||
if [[ $script_name == "linuxtool" ]]; then
|
||||
continue
|
||||
fi
|
||||
script_number=$(( script_number+1 ))
|
||||
echo "${script_number}.${script_name}"
|
||||
script_arr[$script_number]=$script_name
|
||||
done
|
||||
if [ ${#script_arr[@]} == 0 ]; then
|
||||
echo "该地址不存在脚本"
|
||||
exit
|
||||
fi
|
||||
read -p "请输入要删除的序号,多个用 空格 隔开:" script_name
|
||||
for i in $script_name ; do
|
||||
if [[ $i =~ [1-${#script_arr[*]}] ]]; then
|
||||
if [[ $i =~ [1-${#script_arr[@]}] ]]; then
|
||||
echo "开始删除 ${script_arr[$i]}"
|
||||
(crontab -l 2>/dev/null | grep -v "${script_arr[$i]}") | crontab - && echo "已经删除脚本的自动任务"
|
||||
rm -rf "$path/${script_arr[$i]}" &> /dev/null
|
||||
|
@ -20,6 +20,10 @@ case $pick in
|
||||
print_arr[$print_number]=$print_name
|
||||
echo "${print_number}.${print_name}"
|
||||
done
|
||||
if [ ${#print_arr[@]} == 0 ]; then
|
||||
echo "暂时没有安装证书"
|
||||
exit
|
||||
fi
|
||||
read -p "请输入要查看证书详细信息的序号:" pick
|
||||
if [[ $pick =~ [1-${#print_arr[@]}] ]]; then
|
||||
bash "${HOME}/.acme.sh/acme.sh -info -d ${print_arr[$pick]}"
|
||||
|
@ -19,6 +19,10 @@ case $pick in
|
||||
echo "${site_number}.${site_name}"
|
||||
site_arr[$site_number]=$site_name
|
||||
done
|
||||
if [ ${#site_arr[@]} == 0 ]; then
|
||||
echo "暂时没有配置文件"
|
||||
exit
|
||||
fi
|
||||
;;
|
||||
'2')
|
||||
declare -a site_arr
|
||||
@ -34,6 +38,10 @@ case $pick in
|
||||
echo "${site_number}.${site_name}"
|
||||
site_arr[$site_number]=$site_name
|
||||
done
|
||||
if [ ${#site_arr[@]} == 0 ]; then
|
||||
echo "暂时没有配置文件"
|
||||
exit
|
||||
fi
|
||||
read -p "请输入要删除的序号,多个用 空格 隔开:" site_name
|
||||
for i in $site_name ; do
|
||||
if [[ $i =~ [1-${#site_arr[*]}] ]]; then
|
||||
|
Loading…
Reference in New Issue
Block a user