![Skriptantwort auf Apt-Get-Anfrage „Um fortzufahren, geben Sie den Satz ‚Ja, tun Sie, was ich sage!‘ ein“ in Bash](https://rvso.com/image/1452239/Skriptantwort%20auf%20Apt-Get-Anfrage%20%E2%80%9EUm%20fortzufahren%2C%20geben%20Sie%20den%20Satz%20%E2%80%9AJa%2C%20tun%20Sie%2C%20was%20ich%20sage!%E2%80%98%20ein%E2%80%9C%20in%20Bash.png)
Mein Skript ersetzt sysvinit durch systemd in einem Chroot, während ich mit Debootstrap ein Debian-Image erstelle.
Da dies eine „gefährliche“ Aktion ist, stellt apt-get eine dumme Frage: „Um fortzufahren, geben Sie den Satz ‚Ja, tun Sie, was ich sage!‘ ein.“
Wie kann ich die Antwort darauf schreiben?
BEARBEITEN: Ich habe alle Optionen -y --yes --force-yes ausprobiert, aber sie funktionieren nicht.
Antwort1
Seltsamerweise scheint es sogar so zu sein --force-yes
:
apt-get remove -y --force-yes systemd
Jedoch,
echo 'Yes, do as I say!' | apt-get remove systemd
hat sauber geklappt.
Antwort2
apt-get hat einen -y, --yes, --assume-yes
Schalter:
Automatic yes to prompts; assume "yes" as answer to all prompts and
run non-interactively. If an undesirable situation, such as
changing a held package, trying to install a unauthenticated
package or removing an essential package occurs then apt-get will
abort. Configuration Item: APT::Get::Assume-Yes.
oder alternativ ein --force-yes
Schalter:
Force yes; this is a dangerous option that will cause apt to
continue without prompting if it is doing something potentially
harmful. It should not be used except in very special situations.
Using force-yes can potentially destroy your system! Configuration
Item: APT::Get::force-yes
http://manpages.ubuntu.com/manpages/utopic/man8/apt-get.8.html