How to pass y to [y / n] questions in linux automatically

I need to automate some installation, but in some commands it asks "Are you sure you want to continue [y \ n] =?" How do I always pass y

all these types of questions to automate my script?

echo 'y y y' | sudo rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

sudo yum install yum-plugin-replace

sudo yum replace mysql-libs --replace-with mysql55w-libs

sudo yum install mysql.`uname -i` yum-plugin-replace

echo yes "yes" | sudo yum install mysql55w mysql55w-server

sudo service mysqld start

sudo mysql_upgrade -u root

      

here is my shell script I need to execute it completely without prompting.

+3


source to share


2 answers


You can use the utility yes

:



$ yes | sudo rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

      

+1


source


Before resorting to a command yes

(which runs the risk of giving y as an answer to other questions besides yes / no), read the documentation for the command you are using to see if it has the ability to accept yes answer all (or most) interactive tips.



I haven't used it rpm

lately, but the parameter --force

might be what you're looking for.

+1


source







All Articles