- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Using Expect within a Korn Shell script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2003 02:16 AM
тАО10-26-2003 02:16 AM
I've written a korn shell that works OK, but I've now been told that automation of a telnet session is required. Is it possible to write an Expect function which can be called from within the korn shell?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2003 10:43 AM
тАО10-26-2003 10:43 AM
Solution#!/dirpath/expect
.
.
.
then call that script from within your shell script just like any other executable:
#!/usr/bin/ksh
.
.
expectprogram
if [ "$?" != 0 ] ;then
error message
fi
.
.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2003 09:30 PM
тАО10-26-2003 09:30 PM
Re: Using Expect within a Korn Shell script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2003 09:51 PM
тАО10-26-2003 09:51 PM
Re: Using Expect within a Korn Shell script
I think you are out of luck.
Expect can do things that ksh cannot.
That's why it was created.
Don't take my word for it. Visit http://expect.nist.gov/
But if you want to do everything in a single language, maybe Perl ?
There's bound to be a telnet module for Perl out there.
-- Graham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2003 10:23 PM
тАО10-26-2003 10:23 PM
Re: Using Expect within a Korn Shell script
Think I'l stick to calling expect from from ksh :-).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-27-2003 02:31 AM
тАО10-27-2003 02:31 AM
Re: Using Expect within a Korn Shell script
Using a Tcl shell(tclsh) should solve your problems.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-27-2003 03:57 AM
тАО10-27-2003 03:57 AM
Re: Using Expect within a Korn Shell script
#! /blah/blah/tclsh
tcl commands
expectsctipt (args)
tcl commands
exit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-27-2003 04:35 AM
тАО10-27-2003 04:35 AM
Re: Using Expect within a Korn Shell script
Structurally, Expect is actually an extension to another programming language called Tcl. This means that Expect adds commands and functionality to the Tcl language. It also means that to build and use Expect, you must also obtain and build Tcl.
Conceptually, Expect is a chat script generalized to the entire Unix universe
The book Exploring Expect, by Don Libes (O'Reilly & Associates) is very helpful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-27-2003 11:15 PM
тАО10-27-2003 11:15 PM
Re: Using Expect within a Korn Shell script
sndline "cd $files"
receive ">"
sndline "ls -l *.LOG"
receive ">"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-28-2003 10:26 AM
тАО10-28-2003 10:26 AM
Re: Using Expect within a Korn Shell script
Are these korn commands? I'll give them a try....at the moment I'm writing a korn 'main' script with an expect script 'bolted' onto it.
Paddy,
tcl sounds useful for the future, but time contraints are stopping me converting the main script into tcl.
Thanks