Live data from Hacker News

Expect – A tool for automating interactive applications

expect.sourceforge.net

1–10 of 52 posts

Re: Expect – A tool for automating interactive applications

#5
I use it to install MySQL with some non default values. I'm not that good with bash and install scripts and expect was the only way around some issues I was having.

  secure_mysql_script=$(expect -c '
  spawn sudo mysql_secure_installation
  expect "Enter current password for root (enter for none):"
  send "\r"
  expect "Change the root password?"
  send "n\r"
  expect "Remove anonymous users?"
  send "y\r"
  expect "Disallow root login remotely?"
  send "y\r"
  expect "Remove test database and access to it?"
  send "y\r"
  expect "Reload privilege tables now?"
  send "y\r"
  expect eof
  ')
  echo "$secure_mysql_script"

Re: Expect – A tool for automating interactive applications

#9
expect is one of the most useful system administration tools out there! I've used it to batch-modify settings on 100 machines where I couldn't just scp in a new file due to each one needing small variations.

If you don't know expect (and you're a sysadmin), learn it.

Post reply on HN