I'm writing a bash script to install php5.4 and I'd like to automate this for a test VM. The rpm command I have is:

rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm
yum install php54w

Now, in the middle of this running, there is a user prompt to enter [Y/N] whether or not to download the dependencies. So I either need to:

  1. Simulate the user input of [Y]; or

  2. pass in a command for yum not to ask and assume [Y]

What is the best method for a bash script and how do I accomplish both of the above?


You can use the -y switch:

$ yum -y install php54w
excerpt 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
  • Thank You. That was quick. Funny enough I was trying flags on rpm, and couldn't find it - but it makes sense that the yum is where it goes. – Bradley Jul 24 '13 at 19:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.