Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
34
rated 0 times [  34] [ 0]  / answers: 1 / hits: 20361  / 1 Year ago, sun, march 12, 2023, 3:11:59

I am working on a simple bash script that configures new servers how I want them. It's nothing special but it will hopefully save me quite a lot of time in the future.



How do I prevent prompts like this:



  You are about to add the following PPA to your system:
Stable version of nginx.
More info: https://launchpad.net/~nginx/+archive/stable
Press [ENTER] to continue or ctrl-c to cancel adding it


When running commands like this from a script:



  sudo add-apt-repository ppa:nginx/stable 
sudo apt-get update
sudo apt-get -y install nginx


Is there an auto accept flag that I can set or something like that?


More From » apt

 Answers
7

add-apt-repository has a -y flag you can use, which should do the trick.



Though I really want to suggest that you look at configuration management systems like puppet or chef to configure servers. They'll save you a lot of time!


[#32863] Monday, March 13, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
turhizz

Total Points: 82
Total Questions: 106
Total Answers: 96

Location: South Korea
Member since Mon, Dec 6, 2021
2 Years ago
turhizz questions
;