|
|
|
|
|
|
| Author |
Message |
Jeremiah DeWitt Weiner *nix forums Guru Wannabe
Joined: 08 Mar 2005
Posts: 140
|
Posted: Fri Feb 18, 2005 3:43 pm Post subject:
Re: combine shell and expect script
|
|
|
Thens <thens@nospamti.com> wrote:
| Quote: | But, what I want to do is the script should automatically find the
location of expect and exec it with the expect interpreter.
|
Easy - make the shebang line like
#!/usr/bin/env expect
assuming that expect is somewhere in your PATH.
JDW |
|
| Back to top |
|
 |
Kenny McCormack *nix forums Guru
Joined: 24 Mar 2005
Posts: 657
|
Posted: Fri Feb 18, 2005 12:59 pm Post subject:
Re: combine shell and expect script
|
|
|
In article <20050218183336.4b3377dd@asiclindt001>,
Thens <thens@NOSPAMti.com> wrote:
| Quote: | Hello,
Iam writing an expect script to automate an interactive job. The script
could be run in both linux and solaris at my place and the location of
expect varies with the system.
I had
----- script ---------
#!/usr/local/bin/expect
expect script here
but this will not work on solaris, because the expect is at a different
location and ofcouse I could make it work by invoking it as
$ <path to expect> script
But, what I want to do is the script should automatically find the
location of expect and exec it with the expect interpreter.
|
#!/bin/sh
expect -- /dev/fd/5 {yourargs} 5<<- 'X'
{your expect program here}
X
Expect has a "-c" command line option that works like, e.g., "-e" in Perl,
that means "take the program directly from the cmd line instead of from
a file" but I've found it to be a little funky, so I avoid it.
The syntax above has worked flawlessly for me for several years.
</soapbox>
Note further that the #!/path/to/some/interpreter thingie is cute, but not
really that useful and should generally be avoided. |
|
| Back to top |
|
 |
Thens *nix forums beginner
Joined: 21 Feb 2005
Posts: 3
|
Posted: Fri Feb 18, 2005 12:15 pm Post subject:
combine shell and expect script
|
|
|
Hello,
Iam writing an expect script to automate an interactive job. The script
could be run in both linux and solaris at my place and the location of
expect varies with the system.
I had
----- script ---------
#!/usr/local/bin/expect
< expect script here>
but this will not work on solaris, because the expect is at a different
location and ofcouse I could make it work by invoking it as
$ <path to expect> script
But, what I want to do is the script should automatically find the
location of expect and exec it with the expect interpreter. I have done this with perl and will need some help here.
Any pointers ?
Regards,
Thens. |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Thu Jan 08, 2009 11:15 pm | All times are GMT
|
|
Debt Consolidation | Loans | 0 Credit Cards | Mortgage | Personal Loans
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|