Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

apt-get: How to bypass pressing ENTER

I get Press [ENTER] to continue or ctrl-c to cancel adding it while using apt-get in CircleCI. How can I bypass it automatically?
I tried to use -y but no effects!

like image 969
Colin Wang Avatar asked Aug 07 '17 14:08

Colin Wang


Video Answer


2 Answers

This message stems from a call to add-apt-repository.

You can circumvent it with the -y/--yes flag. See the manpage

for example like this:

sudo add-apt-repository --yes ppa:example/repository
like image 79
Philip Stark Avatar answered Sep 29 '22 03:09

Philip Stark


Perhaps you can consider the --force-yes flag. From the manpage:

--force-yes
       Force yes; this is a dangerous option that will cause apt to continue without prompting if it is doing something potentially harmful. It should not be
       used except in very special situations. Using force-yes can potentially destroy your system! Configuration Item: APT::Get::force-yes.

So... caveat emptor

You can make these flags permanent as well. Create a file in /etc/apt/apt.conf.d/, like /etc/apt/apt.conf.d/90_no_prompt with the following:

APT::Get::Assume-Yes "true";
APT::Get::force-yes "true";
like image 29
JNevill Avatar answered Sep 29 '22 03:09

JNevill