在Linux中的脚本中安装应用程序
When I install an application via sudo apt-get install application
, there is a prompt indicating the amount of disk space the application will fill and asks whether or not I want to continue. To continue I would type y
and enter.
当我通过sudo apt-get install应用程序安装应用程序时,会出现一个提示,指示应用程序将填充的磁盘空间量,并询问我是否要继续。要继续,我会键入y并输入。
If I put the command in a script, how can I have the y
and enter execute automatically?
如果我将命令放在脚本中,我怎么能得到y并自动输入执行?
1 个解决方案
#1
1
You can either use yes
to supply an infinite amount of y
's:
您可以使用yes来提供无限量的y:
yes|sudo apt-get install ...
or you can use the -y
flag for apt-get install
或者你可以使用-y标志进行apt-get安装
sudo apt-get -y install ...
Alternatively, you can use --force-yes
with apt-get
to force even potentially dangerous actions. (See man apt-get
for more information about options to apt-get
.)
或者,您可以使用--force-yes和apt-get强制执行甚至是潜在危险的操作。 (有关apt-get选项的更多信息,请参阅man apt-get。)
更多相关文章
- 如何发送一个字节(或字节)来测试在我的应用程序中监听的套接字?
- Bash脚本删除目录中多个文件名末尾的'x'字符数量?
- Bash脚本不删除给定目录中的文件
- Linux Shell脚本攻略
- 〖Linux〗使用Qt5.2.0开发Android的NDK应用程序
- Shell脚本创建linux用户帐户但密码出错
- 《LINUX SHELL脚本攻略》(Sarath Lakshman中文版带书签) 和 英文
- shell脚本let命令在windows下编辑后上传到Linux一直报错
- 使用Bash编写Linux Shell脚本-9. 参数和子壳