简体   繁体   English

如何在交互式 shell 中设置来自 bash 脚本的输入?

[英]How to set input from bash script in an interactive shell?

So when I install percona mysql, I get the following.所以当我安装 percona mysql 时,我得到以下信息。

在此处输入图像描述

I am trying to automate sql installation using a bash script but how do I enter into the input using bash script?我正在尝试使用 bash 脚本自动安装 sql,但如何使用 bash 脚本输入输入? Enter something > hit enter.输入内容 > 回车。

The preferred way of achieving this is using unattended mode by setting the following environment variable before calling apt install :实现此目的的首选方法是通过在调用apt install之前设置以下环境变量来使用无人值守模式

export DEBIAN_FRONTEND=noninteractive

This will not prompt the user for any input but instead use the default values for everything.这不会提示用户进行任何输入,而是对所有内容使用默认值。

If you want to supply an answer to a configuration question different to the default value, use preseeding DebConf .如果您想提供与默认值不同的配置问题的答案,请使用预置 DebConf

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM