[clug] ssh to box, run shell command, then leave shell open?
Andrew Janke
a.janke at gmail.com
Fri Apr 15 00:11:35 MDT 2011
On Fri, Apr 15, 2011 at 16:04, Carlo Hamalainen
<carlo.hamalainen at gmail.com> wrote:
> On Fri, Apr 15, 2011 at 3:50 PM, Andrew Janke <a.janke at gmail.com> wrote:
>> Is this is a use case for an expect script?
>
> Probably - I got the impression that 'expect' was for automating some
> task from start to finish. Can I have it give me the shell back when
> it's done with the custom commands?
My understanding is yes but I haven't ever wanted to do this.
Look I can use google!:
http://www.linuxquestions.org/questions/programming-9/can-expect-return-control-of-a-spawned-process-to-a-shell-script-770340/
Sorry I can't give an exact answer.
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
---
Seems to do what I expect. (ha pun!)
a
More information about the linux
mailing list