[TriLUG] grr... my expect book is at home and google isn't helping

mark at thefowles.com mark at thefowles.com
Fri Jan 20 14:24:49 EST 2006


something like this .....

=================================================
send   "ssh root@$argv\r"
expect  {
        "continue connecting (yes/no)?" {
                send "yes\r"
                expect "password:"
                send "******\r"
        }
        "Name or service not known" {
                return ;
        }
        "password:" {
}
================================================



> People.. I need to do a fairly simple if/then in expect.  I've found some
> examples but not the one I'm loooking for.  Here's what I want, maybe
> someome can help:
>
> I pass a hostname to an expect script, hosts start with either "RTP" or
> "IND"
>
> what I want do is:
>
> if $hostname starts with RTP {
>
> do this
>
> }
>
> elsif $hostname starts with IND {
>
> do this
>
> }
>
> else {
>
> don't do anything
>
> }
>
> I'm still googling, but maybe a helpful expect superperson could shed some
> light here?  Thanks in advance.
>
> Greg
> --
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ  : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the TriLUG mailing list