I've tried reading up on this, but I can't figure out why it's happening.
When Expect sends the password it appears as echoed cleartext in the terminal and afterwards "Sorry, try again." appears.
The script goes as follows
#!/usr/bin/expect -f spawn bash send -- "sudo (many tasks)\r" expect -exact "\[sudo\] password for elade: " send -- "password\r" expect -exact "email@example.com's password: " send -- "password\r" expect "@" send -- "echo Done; sleep 1; exit\r" expect eof
The terminal output after sending first password is:
[sudo] password for elade: password Sorry, try again.
I'm using Arch linux and the terminal emulator Konsole.