#!/usr/bin/expect set timeout 20 set cmd [lindex $argv 0] set arguments [lrange $argv 1 end] spawn $cmd {*}$arguments expect "Email address:" send "__EMAIL__\r"; expect "Password:" send {__PASSWORD__}; send "\r"; expect "Retype password:" send {__PASSWORD__}; send "\r"; interact