<分区>
我正在尝试将以下行添加到 bash 脚本中:
bin/installto.sh /var/www/mail/rc >/dev/null 2>&1
应该没有输出,但升级安装程序需要确认是:
~/roundcubemail-1.2.1# bin/installto.sh /var/www/mail/rc
Upgrading from 1.1.3. Do you want to continue? (y/N)
有没有什么方法可以像 apt-get upgrade -y
一样通过自动确认进行静默升级
最好的问候,爱丽丝
编辑:
直到现在我才知道expect命令
我的脚本:
cd roundcubemail-1.2.1 >/dev/null 2>&1
expect -c 'bin/installto.sh /var/www/mail/rc >/dev/null 2>&1'
expect "Do you want to continue? (y/N)"
send "y"
interact
rm -r /root/roundcubemail-1.2.1/ >/dev/null 2>&1
[...]
--->结果
"bin/installto.sh /var/www/mail/rc"
couldn't read file "Do you want to continue? (y/N)": no such file or directory
/root/update.sh: Zeile 104: send: command not found.
/root/update.sh: Zeile 105: interact: command not found.