Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

Expect script error send: Spawn id exp4 not open while executing

Assuming you're not sending a wrong password on purpose, use exp_continue as a looping construct:

expect <<EOF
set passwds {foo bar baz}
set i 0
spawn ssh -t root@$server_address "$*"
expect {
    "continue connecting (yes/no)?" { send "yes\r"; exp_continue }
    " password: " { send "[lindex $passwds $i]\r"; incr i; exp_continue }
    eof
}
EOF

Tags:

Linux

Unix

Shell

Bash

Expect

Related

How to pass command output as several arguments to another command Force deletion of Windows service Mean Time Between Failures -- SSD Unable to ssh to GCE: "Permission denied (publickey)" How to flush DNS resolver cache on Linux (and FreeBSD) Forward the root domain to the www subdomain using DNS records How to add a file to a docker container which has no root permissions? MSTSC: Black Areas on Remote Desktop nginx uLimit 'worker_connections exceed open file resource limit: 1024' Why do some host volumes in Docker containers give the error "too many levels of symbolic links"? How to ban Syn Flood Attacks using Fail2Ban? Display output with Ansible

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy