如何自动输入 'y' 到 apt-get? [英] How do I enter 'y' automatically to apt-get?

查看:34
本文介绍了如何自动输入 'y' 到 apt-get?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 shell 脚本自动设置服务器.

I'm trying to automate a server setup using a shell script.

我需要使用 apt-get 安装一些依赖项,有些需要用户在安装继续之前输入 y.

I need to install a few dependencies with apt-get and some require the user to input y before the install continues.

我的问题是如何确保 shell 脚本在每次看到类似 Do you want to continue [Y/n]? 时自动插入 y ?

My question is how do I make sure the shell script automatically inserts y every time it sees something like Do you want to continue [Y/n]? ?

我试过 sudo apt-get install git <<'y''y' |sudo apt-get install git 但没有结果.

I've tried sudo apt-get install git << 'y' and 'y' | sudo apt-get install git but with no results.

接下来我可以尝试什么?

What could I try next?

推荐答案

只需使用 -y--yes 标志,如 apt-获取手册页.

Just use the -y or --yes flag as described in the apt-getman pages.

顺便说一句,甚至还有一个选项 --force-yes.所以你有很多选择.

BTW there is even an option to --force-yes. So you got plenty of options at your hands.

这篇关于如何自动输入 'y' 到 apt-get?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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