- Used Books
- Staff Picks
- Gifts & Gift Cards
- Sell Books
- Stores & Events
- Let's Talk Books
Special Offers see all
More at Powell's
Recently Viewed clear list
New Trade Paper
Ships in 1 to 3 days
available for shipping or prepaid pickup only
Available for In-store Pickup
in 7 to 12 days
Other titles in the Nutshell Handbooks series:
Exploring Expect (Nutshell Handbooks)by Don Libes
Synopses & Reviews
Expect is quickly becoming a part of every UNIX user's toolbox. It allows you to automate Telnet, FTP, passwd, rlogin, and hundreds of other applications that normally require human interaction. Using Expect to automate these applications will allow you to speed up tasks and, in many cases, solve new problems that you never would have even considered before.
For example, you can use Expect to test interactive programs with no changes to their interfaces. Or wrap interactive programs with Motif-like front-ends to control applications by buttons, scrollbars, and other graphic elements with no recompilation of the original programs. You don't even need the source code! Expect works with remote applications, too. Use it to tie together Internet applications including Telnet, Archie, FTP, Gopher, and Mosaic.
Don Libes is the creator of Expect as well as the author of this book. In Exploring Expect, he provides a comprehensive tutorial on all of Expect's features, allowing you to put it immediately to work on your problems. In a down-to-earth and humorous style, he provides numerous examples of challenging real-world applications and how they can be automated using Expect to save you time and money.
Expect is the first of a new breed of programs based on Tcl, the Tool Command Language that is rocking the computer science community. This book provides an introduction to Tcl and describes how Expect applies Tcl's power to the new field of interaction automation. Whether your interest is in Expect or interaction automation or you simply want to learn about Tcl and see how it has been used in real software, you will find Exploring Expect a treasure trove of easy-to-understand and valuable information.
Book News Annotation:
Authored by the creator of Expect, this handbook shows how to use this Tcl-based toolkit to automate telnet, passwd, rlogin and other applications in a UNIX environment. Includes an introduction to Tcl (Tool Command Language), and discussions on glob patterns, debugging patterns, handling multiple processes, and the spawn and send commands.
Annotation c. Book News, Inc., Portland, OR (booknews.com)
Written by the author of Expect, this book explains how this part of the UNIX toolbox can be used to automate TelNet, FTP, PASSWD, RLOGIN and other interactive applications. Based on TCL (tool control language), Expect lets the user automate interactive applications.
Written by the author of Expect, this is the first book to explain how this new part of the UNIX toolbox can be used to automate telnet, ftp, passwd, rlogin, and hundreds of other interactive applications. The book provides lots of practical examples and scripts solving common problems, including a chapter of extended examples.
Written by the author of Expect, this is the first book to explain how this part of the UNIX toolbox can be used to automate Telnet, FTP, passwd, rlogin, and hundreds of other interactive applications. Based on Tcl (Tool Command Language), Expect lets you automate interactive applications that have previously been extremely difficult to handle with any scripting language. The book briefly describes Tcl and how Expect relates to it. It then describes the Expect language, using a combination of reference material and specific, useful examples of its features. It shows how to use Expect in background, in multiple processes, and with standard languages and tools like C, C++, and Tk, the X-based extension to Tcl. The strength in the book is in its scripts, conveniently listed in a separate index.
About the Author
Don Libes is married to Susan Mulroney, a professor in the Department of Physiology and Biophysics at the Georgetown University School of Medicine. Sue performs research in the area of kidney growth and development. Their well-hydrated daughter, Kenna, has two lovely kidneys.
Table of Contents
Dedication; Preface; Expect—Why another tool?; Tcl—A Little History; Acknowledgments; Wed Like to Hear From You; How To Read This Book; Notational Conventions; Exercises; Chapter 1: Intro—What Is Expect?; 1.1 Ouch, Those Programs Are Painful!; 1.2 A Very Brief Overview; 1.3 A First Script—dialback; 1.4 Total Automation; 1.5 Differing Behavior When Running Non-Interactively; 1.6 Partial Automation; 1.7 Dangerous, Unfriendly, Or Otherwise Unlikable User Interfaces; 1.8 Graphical Applications; 1.9 A Little More About Tcl; 1.10 Job Control; 1.11 Background Processes; 1.12 Using Expect With Other Programs; 1.13 Using Expect On UNIX; 1.14 Using Expect On Other Operating Systems; 1.15 Using Expect In Real Applications; 1.16 Using Expect In Commercial Applications—Legalese; 1.17 Obtaining Expect and the Examples; 1.18 Expect And Tcl Resources; 1.19 Exercises; Chapter 2: Tcl—Introduction And Overview; 2.1 Everything Is A String; 2.2 Quoting Conventions; 2.3 Expressions; 2.4 Braces—Deferring Evaluation; 2.5 Control Structures; 2.6 More On Expressions; 2.7 Lists; 2.8 More Ways To Manipulate Strings; 2.9 Arrays; 2.10 Indirect References; 2.11 Handling Errors; 2.12 Evaluating Lists As Commands; 2.13 Passing By Reference; 2.14 Working With Files; 2.15 File I/O; 2.16 Executing UNIX Commands; 2.17 Environment Variables; 2.18 Handling Unknown Commands; 2.19 Libraries; 2.20 Is There More To Tcl?; 2.21 Exercises; Chapter 3: Getting Started With Expect; 3.1 The send Command; 3.2 The expect Command; 3.3 Anchoring; 3.4 What Happens When Input Does Not Match; 3.5 Pattern-Action Pairs; 3.6 Example—Timed Reads In The Shell; 3.7 The spawn Command; 3.8 The interact Command; 3.9 Example—Anonymous ftp; 3.10 Exercises; Chapter 4: Glob Patterns And Other Basics; 4.1 The * Wildcard; 4.2 More Glob Patterns; 4.3 Backslashes; 4.4 Handling Timeout; 4.5 Handling End Of File (eof); 4.6 Hints On The spawn Command; 4.7 Back To Eof; 4.8 The close Command; 4.9 Programs That Ignore Eof; 4.10 The wait Command; 4.11 Exercises; Chapter 5: Regular Expressions; 5.1 Regular Expressions—A Quick Start; 5.2 Identifying Regular Expressions And Glob Patterns; 5.3 Using Parentheses To Override Precedence; 5.4 Using Parentheses For Feedback; 5.5 More On The timedread Script; 5.6 Pattern Matching Strategy; 5.7 Nested Parentheses; 5.8 Always Count Parentheses Even Inside Of Alternatives; 5.9 Example—The Return Value From A Remote Shell; 5.10 Matching Customized Prompts; 5.11 Example—A Smart Remote Login Script; 5.12 What Else Gets Stored In expect_out; 5.13 More On Anchoring; 5.14 Exercises; Chapter 6: Patterns, Actions, And Limits; 6.1 Matching Anything But; 6.2 Really Complex Patterns; 6.3 Really Simple Patterns; 6.4 Matching One Line And Only One Line; 6.5 Tcls string match Command; 6.6 Tcls regexp Command; 6.7 Tcls regsub Command; 6.8 Ignoring Case; 6.9 All Those Other String Functions Are Handy, Too; 6.10 Actions That Affect Control Flow; 6.11 Example—rogue; 6.12 Character Graphics; 6.13 More Actions That Affect Control Flow; 6.14 Matching Multiple Times; 6.15 Recognizing Prompts (Yet Again); 6.16 Speed Is On Your Side; 6.17 Controlling The Limits Of Pattern Matching Input; 6.18 The full_buffer Keyword; 6.19 Double Buffering; 6.20 Perpetual Buffering; 6.21 The Politics Of Patterns; 6.22 Expecting A Null Character; 6.23 Parity; 6.24 Length Limits; 6.25 Comments In expect Commands; 6.26 Restrictions On expect Arguments; 6.27 eval—Good, Bad, And Ugly; 6.28 Exercises; Chapter 7: Debugging Patterns And Controlling Output; 7.1 Pattern Debugging; 7.2 Enabling Internal Diagnostics; 7.3 Logging Internal Diagnostics; 7.4 Disabling Normal Program Output; 7.5 The log_user Command; 7.6 Example—su2; 7.7 Recording All Expect Output; 7.8 Sending Messages To The Log; 7.9 About File Names; 7.10 Log And Diagnostic State; 7.11 Exercises; Chapter 8: Handling A Process And A User; 8.1 The send_user Command; 8.2 The send_error Command; 8.3 The expect_user Command; 8.4 Dealing With Programs That Reprompt; 8.5 Dealing With Programs That Miss Input; 8.6 Sleeping; 8.7 Line Versus Character-Oriented And Other Terminal Modes; 8.8 Echoing; 8.9 Prompting For A Password On Behalf Of A Program; 8.10 Security And Insecurity; 8.11 Resetting The Terminal Upon Exit; 8.12 More On The stty Command; 8.13 The system Command; 8.14 Redirecting The Standard Input Or Output; 8.15 The expect_tty Command; 8.16 The send_tty Command; 8.17 Exercises; Chapter 9: The Expect Program; 9.1 Expect—Just Another Program; 9.2 Invoking Scripts Without Saying expect”; 9.3 Rewriting The #! Line; 9.4 The .exp Extension; 9.5 The—And Other Flags; 9.6 The —c Flag; 9.7 The -f Flag; 9.8 Writing The #! Line; 9.9 The -i Flag; 9.10 Thhhhhhe -n And -N Flags; 9.11 The -d Flag; 9.12 The -D Flag; 9.13 The -b Flag; 9.14 The - Flag; 9.15 The interpreter Command; 9.16 Exercises; Chapter 10: Handling Multiple Processes; 10.1 The spawn_id Variable; 10.2 Example—chess Versus chess; 10.3 Example—Automating The write Command; 10.4 How exp_continue Affects spawn_id; 10.5 The Value Of spawn_id Affects Many Commands; 10.6 Symbolic Spawn Ids; 10.7 Job Control; 10.8 Procedures Introduce New Scopes; 10.9 How Expect Writes Variables In Different Scopes; 10.10 Predefined Spawn Ids; 10.11 Exercises; Chapter 11: Handling Multiple Processes Simultaneously; 11.1 Implicit Versus Explicit Spawn Ids; 11.2 Waiting From Multiple Processes Simultaneously; 11.3 Example—Answerback; 11.4 Which Pattern Goes With Which Spawn Id; 11.5 Which Spawn Id Matched; 11.6 Spawn Id Lists; 11.7 Example—Connecting Together Two Users To An Application; 11.8 Example—Timing All Commands; 11.9 Matching Any Spawn Id Already Listed; 11.10 The expect_before And expect_after Commands; 11.11 Indirect Spawn Ids; 11.12 Exercises; Chapter 12: Send; 12.1 Implicit Versus Explicit Spawn Ids; 12.2 Sending To Multiple Processes; 12.3 Sending Without Echoing; 12.4 Sending To Programs In Cooked Mode; 12.5 Sending Slowly; 12.6 Sending Humanly; 12.7 Sending Nulls; 12.8 Sending Breaks; 12.9 Sending Strings That Look Like Flags; 12.10 Sending Character Graphics; 12.11 Comparing send To puts; 12.12 Exercises; Chapter 13: Spawn; 13.1 The Search Path; 13.2 Philosophy--Processes Are Smart; 13.3 Treating Files As Spawned Processes; 13.4 Opening Ttys; 13.5 Bugs And Workarounds; 13.6 Process Pipelines And Ptys; 13.7 Automating xterm; 13.8 Checking For Errors From spawn; 13.9 spawn -noecho; 13.10 Example—unbuffer; 13.11 Obtaining Console Output; 13.12 Setting Pty Modes From spawn; 13.13 Hung Ptys; 13.14 Restrictions On Spawning Multiple Processes; 13.15 Getting The Process Id From A Spawn Id; 13.16 Using File I/O Commands On Spawned Processes; 13.17 Exercises; Chapter 14: Signals; 14.1 Signals; 14.2 Signals In Spawned Processes; 14.3 Notes On Specific Signals; 14.4 When And Where Signals Are Evaluated; 14.5 Overriding The Original Return Value; 14.6 Using A Different Interpreter To Process Signals; 14.7 Exit Handling; 14.8 Exercises; Chapter 15: Interact; 15.1 The interact Command; 15.2 Simple Patterns; 15.3 Exact Matching; 15.4 Matching Patterns From The Spawned Process; 15.5 Regular Expressions; 15.6 What Happens To Things That Do Not Match; 15.7 More Detail On Matching; 15.8 Echoing; 15.9 Avoiding Echoing; 15.10 Giving Feedback Without -echo; 15.11 Telling The User About New Features; 15.12 Sending Characters While Pattern Matching; 15.13 The continue And break Actions; 15.14 The return Action; 15.15 The Default Action; 15.16 Detecting End-Of-File; 15.17 Matching A Null Character; 15.18 Timing Out; 15.19 More On Terminal Modes (Or The -reset Flag); 15.20 Example—Preventing Bad Commands; 15.21 Exercises; Chapter 16: Interacting With Multiple Processes; 16.1 Connecting To A Process Other Than The Currently Spawned Process; 16.2 Connecting To A Process Instead Of The User; 16.3 Example—rz And sz Over rlogin; 16.4 Redirecting Input And Output; 16.5 Default Input And Output; 16.6 Controlling Multiple Processes—kibitz; 16.7 Combining Spawn Ids In A Single -input Or -output; 16.8 Which Spawn Id Matched; 16.9 Indirect Spawn Ids; 16.10 An Extended Example—xkibitz; 16.11 Exercises; Chapter 17: Background Processing; 17.1 Putting Expect In The Background; 17.2 Running Expect Without A Controlling Terminal; 17.3 Disconnecting The Controlling Terminal; 17.4 The fork Command; 17.5 The disconnect Command; 17.6 Reconnecting; 17.7 Using kibitz From Other Expect Scripts; 17.8 Mailing From Expect; 17.9 A Manager For Disconnected Processes—dislocate; 17.10 Expect As A Daemon; 17.11 Example—Automating Gopher and Mosaic telnet Connections; 17.12 Exercises; Chapter 18: Debugging Scripts; 18.1 Tracing; 18.2 Logging; 18.3 Command Tracing; 18.4 Variable Tracing; 18.5 Example—Logging By Tracing; 18.6 UNIX System Call Tracing; 18.7 Tk And tkinspect; 18.8 Traditional Debugging; 18.9 Debugger Command Overview And Philosophy; 18.10 Stepping Over Procedure Calls; 18.11 Stepping Into Procedure Calls; 18.12 Where Am I; 18.13 The Current Scope; 18.14 Moving Up And Down The Stack; 18.15 Returning From A Procedure; 18.16 Continuing Execution; 18.17 Defining Breakpoints; 18.18 Help; 18.19 Changing Program Behavior; 18.20 Changing Debugger Behavior; 18.21 Exercises; Chapter 19: Expect + Tk = Expectk; 19.1 Tk—A Brief Technical Overview; 19.2 Expectk; 19.3 The send Command; 19.4 An Extended Example—tkpasswd; 19.5 The expect Command And The Tk Event Loop; 19.6 The expect_background Command; 19.7 Multiple Spawn Ids In expect_background; 19.8 Background Actions; 19.9 Example—A Dumb Terminal Emulator; 19.10 Example—A Smarter Terminal Emulator; 19.11 Using The Terminal Emulator For Testing And Automation; 19.12 Exercises; Chapter 20: Extended Examples; 20.1 Encrypting A Directory; 20.2 File Transfer Over telnet; 20.3 You Have Unread News—tknewsbiff; 20.4 Exercises; Chapter 21: Expect, C, And C++; 21.1 Overview; 21.2 Linking; 21.3 Include Files; 21.4 Ptys And Processes; 21.5 Allocating Your Own Pty; 21.6 Closing The Connection To The Spawned Process; 21.7 Expect Commands; 21.8 Regular Expression Patterns; 21.9 Exact Matching; 21.10 Matching A Null; 21.11 What Characters Matched; 21.12 When The Number Of Patterns Is Not Known In Advance; 21.13 Expecting From Streams; 21.14 Running In The Background; 21.15 Handling Multiple Inputs And More On Timeouts; 21.16 Output And Debugging Miscellany; 21.17 Pty Trapping; 21.18 Exercises; Chapter 22: Expect As Just Another Tcl Extension; 22.1 Adding Expect To Another Tcl-based Program; 22.2 Differences Between Expect And The Expect Extension In Another Program; 22.3 Adding Extensions To Expect; 22.4 Adding Extensions To Expectk; 22.5 Creating Script-less Expect Programs; 22.6 Functions And Variables In The Expect Extension; 22.7 Exercises; Chapter 23: Miscellaneous; 23.1 Random Numbers; 23.2 Example—Generating Random Passwords; 23.3 The Expect Library; 23.4 Expect Versions; 23.5 Timestamps; 23.6 The time Command; 23.7 Exercises; Appendix—Commands and Variables; Commands And Flags; Variables;
What Our Readers Are Saying
Other books you might like