say yes to everything

October 23rd, 2006 mysurface Posted in Admin, alias, Misc, yes, yum | Hits: 43400 | 4 Comments »

Sometimes some commands always like to ask you for comfirmation. Are you sure … (Y/n). Sometimes, that is irritating, especially when you do yum update.

yum is package manager for Red Hat based linux, it usually takes a long time to get ready to download the update packages. Once yum is ready, it will ask you for confirmation, it usually ask “Are you sure you want to update ? ( Y/n ).”

I usually do

yum update

and walk away, I expect it to update everything, when I come back. But when I came, I realized that it doesn’t actually update, instead it ask you for confirmation.

To say yes for everything, you can uses command yes. Therefore, it solves the problem describe above.

yes | yum update

Command yes will keep replies y and enter until the execution is ended.

But I always forgot to add yes infront of yum. I have a trick, create an alias. Add the line bellow to your ~/.bashrc

alias yum="yes |  yum"

When you type yum, it will automatically replace by yes | yum.

4 Responses to “say yes to everything”

  1. cool, easier than writing an expect script.

  2. In the case of Yum, you can use the -y option to skip all the questions as though you’ve typed “yes” to everything:

    yum update -y

    Or as an alias:

    alias yum=’yum -y ‘

  3. You are right, yum -y works as expected. Thanks.

  4. Another possible way to answer YES on prompt is to add assumeyes=1 to yum.conf located in /etc This works in exactly the same way as -y on command line.


Leave a Reply