Example script responding on a netcat connection
#!/usr/bin/expect set timeout -1 spawn nc -l 1234 while {1} { expect "hello" send "haliho\r" }
Another example: mirroring local website on the web. Login information is in .netrc
#!/usr/bin/expect system "logger 'starting http mirror'" cd /var/www/html spawn ftp ftp.fortunecity.com expect "ftp>" send "prompt\r" expect "ftp>" send "mput *.html\r" expect "ftp>" send "quit\r"