6

I am using "apt-get remove" to remove a package but during installation it asks me to enter yes/no twice for two different reason.

So I want my input to be yes for first question and no for second question.

Below is the code I am using with '-y' as option but it sets yes for all interaction.

apt-get --purge -y -f remove grub-pc

Can anyone tell me how to achieve what I have mentioned?

3
  • 2
    Possible duplicate of apt-get --force-yes: How to suppress further questions
    – Brane
    Aug 27, 2016 at 9:08
  • 2
    I can guess the first question, what is the second question? You can edit the question to add details
    – Anwar
    Aug 28, 2016 at 17:49
  • this is definitely not a duplicate of that post. OP knows how to force yes, and wants to apply an automatic yes and then no
    – Zanna
    Aug 29, 2016 at 21:51

1 Answer 1

1

Something like this?

printf "yes\nno\n" | sudo apt-get ...

Obviously, don't use -y, because you provide the answers you want using the piped output from printf. You also need to know exactly how many answers you have to answer, and the right answer to give.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .