linux - Bash Roundcube 脚本无声

标签 linux bash

<分区>

我正在尝试将以下行添加到 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.

最佳答案

你知道expect命令吗?

expect -c 'bin/installto.sh /var/www/mail/rc >/dev/null 2>&1'
expect "Do you want to continue? (y/N)"
send "y\n"
interact

关于linux - Bash Roundcube 脚本无声,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39190109/

相关文章:

linux - 为什么我不能从符号链接(symbolic link)中处理 ".."中的文件?

mysql - 如何从 shell 脚本自动登录 MySQL?

java - JAVE (Java Audio Video Encoder) 库异常仅在 Linux (CentOS 7)

linux - 将文件名保存为递增数字

c++ - Linux 上找不到 SDL 库

linux - 如何使用 ping 返回值来触发 bash 命令

linux - 提取音频,再次操作和合并

linux - 为什么Linux不需要驱动程序

linux - 如何检测文件系统是否支持权限?

regex - AWK - 从文件导入 IF 条件