Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've downloaded Java (jdk-6u31-linux-x64.bin) from oracle.com. I run the executable, files are successfully unpacked, but then there is a message about registration and it sits at

Press Enter to continue...

I need to be able to run this automatically from a script. Is there a straightforward way to skip or automatically dismiss this prompt?

share|improve this question
    
If your Linux is Debian, you should use java-package to turn that .bin into a .deb. Which shouldn't display that message. –  Dan D. May 1 '12 at 23:56

1 Answer 1

up vote 3 down vote accepted
touch answers && ./jdk-6u31-linux-x64.bin < answers && rm answers

This command does the following:

  1. touch answers Create an empty text file called answers in the current directory
  2. ./jdk-6u31-linux-x64.bin < answers Execute the Java installer and redirect stdin from the empty answers file
  3. rm answers Delete the temporary file when finished
  4. && Combine three operation into a single line. Only execute the next command if the previous command completed successfully
share|improve this answer
1  
When suggesting a user execute commands, it's helpful to explain what they do. –  Darth Android May 2 '12 at 3:26
1  
I think you want && instead of & –  bstpierre May 2 '12 at 14:19
    
& will run them simultaneously, && will run as long as the previous exited successfully (exit code 0), and ; will run after the previous command is finished regardless of it's exit code. –  Rob May 2 '12 at 14:40
    
You're correct. Update to use &&. –  Mike Willekes May 2 '12 at 17:02

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.