You are not logged in.

#1 2015-08-01 10:38:01

folatt
Member
Registered: 2015-08-01
Posts: 96

Which command for pacman to automatically answer a certain question?

And I mean to answer this particular question with "2":

:: There are x available providers for y
:: Repository extra
1) option_1 2) option_2
Enter a number (default=1):

I need it for a script.

Offline

#2 2015-08-01 10:55:47

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Which command for pacman to automatically answer a certain question?

Install option_2 with 'pacman -Syu option_2'.

Offline

#3 2015-08-01 11:30:32

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,548
Website

Re: Which command for pacman to automatically answer a certain question?

Karol, you'd need to know what the options were in advance to do that.  While it's likely this will work for the OP, a more general answer that gets at the question as asked:

echo 2 | pacman -S <option>

Althought this method assumes both that the *correct* answer will always remain 2 forever, and more importantly that there will always be a question asked needing input.  If the two packages are merged, or one is removed from the repos, then suddenly that input of '2' might go for the next question of whether you want to continue [Y/n] (in which case it would be treated as a 'no'.)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

Board footer

Powered by FluxBB