I want to avoid having to manually type Y/n for apt-get in shell scripts

Asked 2 years ago, Updated 2 years ago, 62 views

a.sh

 sudo apt-get update
sudo apt-get upgrade

I wrote the shell script
Now, I'm told Y/n, but I'd like to automate this. What are the ways?

[Additional note]

 sudo apt-get install hogehoge

What should I do if

ubuntu apt

2022-09-29 22:51

3 Answers

 sudo apt-get-y update
sudo apt-get-y upgrade


2022-09-29 22:51

For information:

If y is enough, the generic one is yes|.... (Other than y, you can do it.)


2022-09-29 22:51

update/upgrade/install In any case, -y is fine, and manapt-get also says:

-y, --yes, --assume-yes
US>Automatic acceptance to prompts— Automatically answers "yes" to all prompts and runs non-interactive.apt-get interrupts the process in the event of an inappropriate situation, such as changing the state of a pending package or deleting a mandatory package.configuration items:APT::Get::Assume-Yes


2022-09-29 22:51

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.