10

When I run installs in Fedora with say yum groupinstall "Development Tools", I am sometimes prompted to hit y/N.

Can I tell the OS to automatically choose "y" when such prompts occur? That would let me leave my computer for a while and come back.

Sildoreth
  • 1,884
  • 5
    There is a -y option that goes along with yum that does that exact thing. Read the man page for more information on it. – Bratchley Jan 14 '14 at 20:41

3 Answers3

18

Try this:

$ sudo yum -y groupinstall "Development Tools"

From the yum man page:

   -y, --assumeyes
          Assume yes; assume that the answer to any question which would be 
          asked is yes.
          Configuration Option: assumeyes

NOTE: You could use yes as well but it isn't really necessary. The yum tool has a builtin switch for doing exactly this.

slm
  • 369,824
2

Yes, you can, with yes. If you run it without arguments, it prints the letter y indefinitely to stdout, and if you give it an argument, string or letter or anything, it will print that indefinitely to stdout.

In your case you would do it as follows:

yes | yum groupinstall "DevelopmentTools" 
  • naw, use the -y option, less typing. – Panther Jan 14 '14 at 20:44
  • @bodhi.zazen Yeah, now I know that. I wasn't aware of that when I wrote my answer, and I thought I'd post my answer using yes, which is kinda standard way of doing the thing the OP wanted. However, when I started writing this answer, there were no other A's. When I posted my A, I noticed that slm had posted his A just before I had. –  Jan 15 '14 at 05:58
  • -bash: yes : command not found How to prevent this error too ? – Chaminda Bandara Jun 24 '21 at 06:46
-1

/usr/bin/yes is a tool that constantly sends y\n to stdout. You can pipe that into any command that gives Y/N style prompts to force a "yes" answer to any such questions. You can also use yes to send any other string you like by specifying it upon invocation, e. g. /usr/bin/yes foo will send foo\n to stdout for as long as its output is being read.

DopeGhoti
  • 76,081