我如何编写一个“是"的脚本?安装程序的响应? [英] How do I script a "yes" response for installing programs?

查看:11
本文介绍了我如何编写一个“是"的脚本?安装程序的响应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Amazon Linux 实例,我有几个脚本来填充数据并安装我使用的所有程序,但有几个程序会询问:

I work with Amazon Linux instances and I have a couple scripts to populate data and install all the programs I work with, but a couple of the programs ask:

Do you want to continue [Y/n]?

并暂停安装.我想在所有情况下都自动回答Y",我现在才知道该怎么做.

and pause the install. I want to auto answer "Y" in all cases, I'm just now sure how to do it.

推荐答案

'yes' 命令 将无限期地回显y"(或您要求的任何内容).将其用作:

The 'yes' command will echo 'y' (or whatever you ask it to) indefinitely. Use it as:

yes | command-that-asks-for-input

或者,如果需要大写的Y":

or, if a capital 'Y' is required:

yes Y | command-that-asks-for-input


如果你想传递'N',你仍然可以使用yes:

yes N | command-that-asks-for-input

这篇关于我如何编写一个“是"的脚本?安装程序的响应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆