58

I am trying to write a bash script to install a list of software. I am using --assume-yes to get past the prompts.

This following line somehow doesn't work:

sudo apt-get install python-software-properties --assume-yes

If I try to apt-get without --assume-yes it works but the prompt asks me to:

please [Enter] to continue or ctrl+c to cancel adding it

How do I add Enter as a command when running apt-get install instead of using --assume-yes?

  • please [Enter] to continue or ctrl+c to cancel adding it it only appears if you are trying to add a PPA. – Avinash Raj Apr 16 '14 at 3:49
78

Your problem is that the option should be before the packages, not after, this is the correct syntax:

apt-get <options> command package=version/release

So, for it to work it should be:

sudo apt-get --assume-yes install python-software-properties

apt-get is forgiving when mixing up command and options, but to err on the safe side, you should always use the options before the command and never put options or commands after the name of the package.

43

Add -y flag to apt-get install <package-name> command like below, you won't get any prompt while installing packages.

sudo apt-get install -y <package-name>

From apt-get --help

-y  Assume Yes to all queries and do not prompt
  • Is there a difference between --assume-yes and -y? – Peter Mortensen Nov 26 '17 at 17:39
  • 1
    @PeterMortensen they do the same thing. From the man page:-y, --yes, --assume-yes Automatic yes to prompts – davejagoda Dec 6 '17 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.