When everything else fails try:   #!/usr/bin/expect set timeout 19900 spawn /bin/bash expect -re "]# " send "rsync -av –delete user@host:someremotefolder/ somelocalfolder\r" expect -re "password:" sleep 2 send "userpassword\r" expect -re "total size is" expect -re "]# " send "exit\r"#!/usr/bin/expect set timeout 19900 spawn /bin/bash expect -re "]# " send "rsync -av –delete user@host:someremotefolder/ somelocalfolder\r" […]