Skip to content

Instantly share code, notes, and snippets.

@saghul
Created June 12, 2011 21:41
Show Gist options
  • Save saghul/1022020 to your computer and use it in GitHub Desktop.
Save saghul/1022020 to your computer and use it in GitHub Desktop.
imapfilter + expect automation
#!/bin/bash
_exit() {
echo "CTRL + C pressed, exiting."
exit 0
}
trap _exit INT
read -p "Password: " -s PASSWORD
while [[ true ]]; do
expect -c "
spawn imapfilter -v -c ag-projects.lua
expect {
"*password*:" { send $PASSWORD\r\n; interact }
eof { exit }
}
exit
"
echo "Something went wrong with imapfilter, will restart in 5 seconds."
sleep 5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment