The answer was given to me by Alexis Lee thanks
Anyway the scripts is like this
---------------CUT here--------------------------------
#!/usr/bin/expect --
should be -f at the end of this line not --
# # In this program, we telnet to a host, execute two commands, # and leave.
# prevent an untimely end. If you have a command that takes a # time, adjust this set timeout 5000
# We start a telnet session............................. spawn telnet 192.168.0.97
# A telnet session begins with a login prompt, so we 'expect' # one here, and send the username in response. # The \r represents a carriage return. Everytime you would press # <Enter> # interactively, send a \r.
expect "login: " send "oms101\r"
# We then send the password, note thats not my password expect "assword: " send "mylittlelinuxbox\r" send "xterm &\r"
now here the xterm & executes to fast so after the password is entered I put in a
sleep 1
and a useful command I did not know about called
interact
bet you can guess what it does.
unfortunately the script finishes so fast that the xterm & does not work but xterm does so I just changed it to xterm
Thanks
Owen Synge
# We know in advance what our command prompt is, and we # 'expect' it accordingly. If we get it, we send the # 'mkdir test' and press enter (\r) expect " >" send "mkdir test\r"
exit
---------------CUT here--------------------------------
maybe it is time to learn python! anyway some background here is a screen scrape from the execution of the script
---------------CUT here--------------------------------
fred_grip
spawn telnet 192.168.0.97 Trying 192.168.0.97... Connected to 192.168.0.97. Escape character is '^]'. Welcome to SuSE Linux 7.0 (i386) - Kernel 2.2.16 (2).
ford login: oms101 Password: Last login: Wed Mar 28 10:00:24 from charly.local Have a lot of fun... oms101@ford:~ > >
---------------CUT here--------------------------------
and here is what happens when I telnet in and ls the root directory unfortunately no sign of my new test directory, whats going on?
---------------CUT here--------------------------------
oms101@ford:~ > ls mp3 nsmail wav oms101@ford:~ >
---------------CUT here--------------------------------
Chears
Owen
Date: 30-Jul-01 Time: 19:47:52
alug, the Anglian Linux User Group list Send list replies to alug@stu.uea.ac.uk http://www.anglian.lug.org.uk/ http://rabbit.stu.uea.ac.uk/cgi-bin/listinfo/alug See the website for instructions on digest or unsub!
Date: 01-Aug-01 Time: 01:06:32