Echo response to command in Shell (Linux Ubuntu 16.04.3 LTS)

John Smith asked:

(In order to skip the are you sure warning of the disk space)
I tried apt-get install php && echo Y
but it does not work. It still asks for the warning.

What I can do?

Thanks!

My answer:


The man page says you should use the -y option.

    -y, --yes, --assume-yes
            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 or removing an essential package, occurs
            then apt-get will abort.

That is to say:

apt-get -y install php

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.