I am creating a script to setup a series of computers. One of the apps to install is a mysql database. The bash script will call
sudo mysql_secure_installation
The expect script will have to respond to the questions that are output in sequence from this command, answers will be hardcoded and will be the same for all.
Questions and responses are
Enter current password for root (enter for none): Just press the Enter
Set root password? [Y/n]: Y
New password: Enter password
Re-enter new password: Repeat password
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]: Y
Reload privilege tables now? [Y/n]: Y