0%

Bshell静默安装跳过提示框

Bshell静默安装跳过提示框

QQ群:397745473

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Shell 交互输入自动化 https://geek-docs.com/shell/shell-examples/shell-interactive-typing-automation.html

# 参考:https://www.freesion.com/article/52181413742/
# expect中兼容操作系统不同编码

tool_name="sysstat"
if [ ! -f install_$tool_name.sh ] ;then
cat >>install_$tool_name.sh <<-EOF
#! /usr/bin/expect

set timeout 30
spawn apt-get install -y $tool_name
expect {
"Package*" { send "exit\r" }
"软件包设置*" { send "exit\r" }
}
interact
EOF
expect install_$tool_name.sh
fi

QQ群:397745473

欢迎关注我的其它发布渠道