How to answer interactive install questions in a bash script


I want to make the install of letsencypt part of a bash script to install a variety of other software. Within the configuration file for the script I already have the email address as a variable which shall be entered automatically when letsencrypt is installed.

How can I avoid that the installation process is interrupted by the question asking for the email address as well as defaulting to “I agree” on the second question.

Is there any way to answer these two questions when calling letsencrypt-auto so that the install process is not stopped by the questions?

Thanks for any hints

You can use the --non-interactive (-n) flag. This means that you’ll need to pass some details as arguments, for example via --email and --agree-tos. You can run ./letsencrypt-auto --help all to see all CLI options.