I am using the line below in my script
add-apt-repository ppa:webupd8team/java
When it is run from the script I get a prompt to press [return] to confirm adding the source to the repositories
Can I automate that return?
Secondly, I am installing oracle-java7-installer and there is a license agreement that prompts for the user to: 1.. OK the License agreement 2.. select YES to Accept License Terms
Can I automate the OK and automate the keypad left & OK to Accept License Terms? This script is for testing locally and I do want the script to pause for these user inputs each time.
I have seen this method of piping YES to a command:
yes | <command here>
I am hoping there is a similar method to automate these steps...
For add-apt-repository
you can use the -y
flag to skip the yes/no prompt.
The Oracle Java one is a little more complicated, but this will do what you want:
echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections
# Install required packages
sudo apt-get install oracle-java7-installer -y
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With