Re: expect in bash script ?
- From: es_ <es_uomikim@xxxxxxxxxxxxxx>
- Date: Sat, 03 Jun 2006 22:07:48 +0200
Chris F.A. Johnson wrote:
Exactly as shown in the part of the message you quoted, where
expect_script is the command that runs your script.
OK, maybe I don't understand something. Tell me what's wrong; here's the
example:
ver 1:
--------------
#!/bin/bash
var=$(expect ftp some.ftp.addres
expect "Name"
send "myname\r"
expect "Password:"
send "mypass\r"
expect "ftp>"
send "cd some_directory"
expect eof)
echo $var
--------------
result:
--------------
$ ./script.sh
couldn't read file "ftp": no such file or directory
couldn't read file "Name": no such file or directory
../script.sh: line 3: send: command not found
couldn't read file "Password:": no such file or directory
../script.sh: line 5: send: command not found
couldn't read file "ftp>": no such file or directory
../script.sh: line 7: send: command not found
couldn't read file "eof": no such file or directory
--------------
ver 2:
--------------
#!/bin/bash
var=$(expect ftp some.ftp.addres expect "Name" send "myname\r" expect
"Password:" send "mypass\r" expect "ftp>" send "cd some_directory\r"
expect eof)
echo $var
--------------
result:
--------------
$ ./script.sh
couldn't read file "ftp": no such file or directory
--------------
greetz,
T
--
"Przyjacielu, lepiej nas dobrze wypieprz zamiast prawić nam kazania.
Nawrócić nas nie zdołasz..." Marquis Donatien Alphonse François de Sade
.
- Follow-Ups:
- Re: expect in bash script ?
- From: Xicheng Jia
- Re: expect in bash script ?
- References:
- expect in bash script ?
- From: es_
- Re: expect in bash script ?
- From: slakmagik
- Re: expect in bash script ?
- From: es_
- Re: expect in bash script ?
- From: Chris F.A. Johnson
- expect in bash script ?
- Prev by Date: Re: expect in bash script ?
- Next by Date: Re: Return yesterday's date
- Previous by thread: Re: expect in bash script ?
- Next by thread: Re: expect in bash script ?
- Index(es):
Relevant Pages
|