narasimharao vayala narasimharao vayala -5 years ago 378
Bash Question

What does spawn ,expect and send command in linux/unix

The following three lines having three commands(spawn,expect,send), but what it does actually. Please explain any one

spawn ssh -oStrictHostKeyChecking=no -oCheckHostIP=no usr@$'

expect "password"

send "$PWD\n"


Thank you...

Answer Source

It is part of an expect script:

spawn opens a new process

expect waits for the previous spawned process to output the "expected" string (password in this case)

send writes to the spawned process stdin

EOD has no meaning in expect, perhaps it is part of another script?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download