• Important: We recently upgraded our forum software - please let us know if you run into any issues.

scripting with expect

E

Erik_loa

Guest
Hello

I try these lines in a file called hepp.bash

------------------------
#!/usr/bin/expect
expect "hello"
------------------------

when I do:

bash hepp.bash

I get:
couldn't read file "hello": no such file or directory

(I have version 5.44.1.15 installed.)

I guess I am doing some fundamental wrong since I have not been able to find anyone
having this problem :)

when I just write expect in the commadn line then the the command line changes to
expect1.1>

if I then write expect "hello"
then it works.

My question, how do I get expect to work in a script file ?

BR
/Erik
 


P

Peytonsmith

Guest
i would also like to get some helpful responses over the topic just to get an additional;l knowledge about the subject .. have gone to the web for some apt suggestions but didn't find there anything supportive .. now going to my mentor for a help..
 
E

eugenyb

Guest
[email protected]: touch test

Write this:
#!/usr/local/bin/expect -f
send "hello\n"
#here is my $bin_directory /usr/local/bin/

then make this file executable:
chmod +x test.sh
And then launch it:
[email protected]: ./test
It'll be working fine:

[email protected]: ./test
hello


It seems to me, you don't now how to use expect scripts :)
What do you want to do with expect tcl?
It's quite well to work with TTY and VTY like telnet, ssh command prompts.
A typical usage of expect is to configure devices with vty/tty interfaces.
 
R

ryanvade

Guest
If possible, you may want bash and not expect. Just saying.;)
 

Members online



Top