0

My goal is to uninstall PostgreSql (installed on a Linux host- Ubuntu 18.04 LTS) using a bash script file.

I use the following command:

apt remove --purge -y postgresql-12 && apt autoremove -y

The problem is that, launching it from the terminal, at a certain point it opens a confirmation window (you have to press enter to go on).

So when I put this command in the bash script file, it gets stuck (as I assume it is waiting for confirmation).

I tried also with 'apt-get' instead of 'apt', but nothing changed.

I tried also adding option '-qq' or --assume-yes, but nothing changed.

How can I solve the problem?

1 Answer 1

0

You want to set the DEBIAN_FRONTEND environment variable to noninteractive as explained in man 7 debconf:

noninteractive
This is the anti-frontend. It never interacts with you at all, and makes the default answers be used for all questions. It might mail error messages to root, but that's it; otherwise it is completely silent and unobtrusive, a perfect frontend for automatic installs. If you are using this front-end, and require non- default answers to questions, you will need to preseed the debconf database; see the section below on Unattended Package Installation for more details.

2
  • Does it work in Ubuntu 18.04 too?
    – Fausto70
    Commented Nov 16, 2021 at 17:18
  • @Fausto70: yes. Ubuntu is based on Debian. Commented Nov 17, 2021 at 10:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .