fix: 优化 Bash 安装检查逻辑
This commit is contained in:
parent
aab132a900
commit
488cb36e66
@ -43,12 +43,8 @@ check_jq(){
|
|||||||
|
|
||||||
# 检查 Bash 是否已安装
|
# 检查 Bash 是否已安装
|
||||||
check_bash_installed() {
|
check_bash_installed() {
|
||||||
if command -v bash &> /dev/null; then
|
if ! command -v bash &> /dev/null; then
|
||||||
echo "Bash 已安装"
|
echo "错误: Bash 未安装!"
|
||||||
return 0 # 返回 0 表示 Bash 已安装
|
|
||||||
else
|
|
||||||
echo "Bash 未安装"
|
|
||||||
return 1 # 返回 1 表示 Bash 未安装
|
return 1 # 返回 1 表示 Bash 未安装
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
15
install.sh
15
install.sh
@ -1,15 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# 检查 Bash 是否已安装
|
script_dir="$(cd "$(dirname "$0")"; pwd)/bin" # 脚本所在目录
|
||||||
check_bash_installed() {
|
source "${script_dir}/utils/base.sh"
|
||||||
if command -v bash &> /dev/null; then
|
|
||||||
echo "Bash 已安装"
|
# 检查bash环境是否安装
|
||||||
return 0 # 返回 0 表示 Bash 已安装
|
check_bash_installed
|
||||||
else
|
|
||||||
echo "Bash 未安装"
|
|
||||||
return 1 # 返回 1 表示 Bash 未安装
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# 显示菜单
|
# 显示菜单
|
||||||
echo "请选择一个操作:"
|
echo "请选择一个操作:"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user