[clug] ssh to box, run shell command, then leave shell open?
Andrew Janke
a.janke at gmail.com
Fri Apr 15 00:15:19 MDT 2011
> Ok, just went and looked, answer is yes (I think)
>
> cai-harold:~$ cat script.exp
> #! /usr/bin/expect -f
>
> spawn ssh cai-george
> send -- "hostname\n"
>
> expect eof
Arrrgh! rong.
try this:
---
#! /usr/bin/expect -f
spawn ssh cai-george
# wait for the prompt
expect "$"
send -- "hostname\n"
interact
---
Previous version "worked" and then dumped you out after a few seconds!
a
More information about the linux
mailing list