Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

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
share|improve this answer
    
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
    
@Bradley - Glad it helped. Please mark this as the accepted answer so that everyone knows your issue's been resolved. –  slm Jul 24 '13 at 19:53
    
I intend to! I have to wait '2 more minutes' by stackexchange rules. –  Bradley Jul 24 '13 at 19:59
    
@Bradley - sorry I never realized there was a time limit on that 8-). –  slm Jul 24 '13 at 20:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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