Dear all,
I have a code which needs to do :
spawn ftp 10.4.12.22
expect "Name (10.4.12.22:mmsadmin):"
send "BillingUser\r"
expect "Password:"
send "BillingUser\r"
expect "ftp>"
send "bye"
but when i run its say spawn, send and expect is not found...
how can i enable or install spawn, expect and send libraries...
Kindly help me out...
BR/Asad
Hi,
There's an easier way to do this without using expect. It's by using a .netrc file (man 5 netrc) like this -
$ cat .netrc
machine my.server.here
login my_username
password itsasecret
macdef init
cd /path/to/go/to
$ chmod 400 .netrc
$ ftp my.server.here
... login without prompting ...
... cd's to directory specified and runs any other commands ...
The only gotcha to watch out for is the 2 blank lines after the end of the init macro. They must be there or it wont work.
Hope this helps,
-c