I have the following file: exp.exp
#!/usr/bin/expect db_host='localhost' db_name='webui_dev' db_user='root' db_pass='rootpass' new_db_name='db_2011' expect <<EOF log_user 0 spawn mysql -h $db_host -u $db_user -p $db_pass 'create database $new_db_name' expect "password:" send "$db_pass\r" log_user 1 expect eof EOF
I make it executable by
sudo chmod +x script/year_changer/create_db.exp, but if I try to execute it I get an error:
couldn't execute "mysql": no such file or directory while executing "spawn mysql -h localhost -u root -p rootpass 'create database db_2011'"