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?
Best Answer
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 fromprintf
. You also need to know exactly how many answers you have to answer, and the right answer to give.