add command_exists

This commit is contained in:
Konano 2023-11-16 11:19:02 +08:00
parent f207a7f2b5
commit e85db23b7a
2 changed files with 6 additions and 0 deletions

View File

@ -109,6 +109,8 @@ configure_tmux() {
} }
configure_docker() { configure_docker() {
command_exists docker && return
if confirm_action "要安装 docker 吗?" "N"; then if confirm_action "要安装 docker 吗?" "N"; then
# 卸载旧版本 # 卸载旧版本
sudo apt remove docker docker-engine docker.io sudo apt remove docker docker-engine docker.io

View File

@ -53,6 +53,10 @@ confirm_action() {
[[ $response =~ ^[Yy]$ ]] [[ $response =~ ^[Yy]$ ]]
} }
command_exists() {
command -v "$@" >/dev/null 2>&1;
}
# ============================================================ # ============================================================
check_google_access check_google_access