Skip to content

Instantly share code, notes, and snippets.

@kpietru
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kpietru/a3cb08ee074a4418795a to your computer and use it in GitHub Desktop.
Save kpietru/a3cb08ee074a4418795a to your computer and use it in GitHub Desktop.
Expect inside shell + install mysql-server + variables
#!/bin/bash
MYSQL_PASSWORD="pass"
export MYSQL_PASSWORD="$MYSQL_PASSWORD"
# Debug
#expect -D 1 -c '
expect -c '
spawn apt-get install -y mysql-server
expect "*password* user:"
send "$env(MYSQL_PASSWORD)\r"
expect "*password* user:"
send "$env(MYSQL_PASSWORD)\r"
expect "\r"
send "enter\r"
interact'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment