I work with Amazon Linux instances and I have a couple scripts to populate data and install all the programs I work with, but a couple of the programs ask:
D
echo y | command should work.
echo y | command
Also, some installers have an "auto-yes" flag. It's -y for apt-get on Ubuntu.
-y
apt-get