AskDefine | Define expect

Dictionary Definition

expect

Verb

1 regard something as probable or likely; "The meteorologists are expecting rain for tomorrow" [syn: anticipate]
2 consider obligatory; request and expect; "We require our secretary to be on time"; "Aren't we asking too much of these children?"; "I expect my students to arrive in time for their lessons" [syn: ask, require]
3 look forward to the probable occurrence of; "We were expecting a visit from our relatives"; "She is looking to a promotion"; "he is waiting to be drafted" [syn: look, await, wait]
4 consider reasonable or due; "I'm expecting a full explanation as to why these files were destroyed"
5 be pregnant with; "She is bearing his child"; "The are expecting another child in January"; "I am carrying his child" [syn: have a bun in the oven, bear, carry, gestate]
6 look forward to the birth of a child; "She is expecting in March"

User Contributed Dictionary

English

Etymology

Latin expectatum (to look out for, await, expect), ex (out) + spectare (to look at). Confer spectacle.

Pronunciation

  • /ɪkˈspɛkt/
  • Rhymes: -ɛkt

Verb

  1. To look for (mentally); to look forward to, as to something that is believed to be about to happen or come; to have a previous apprehension of, whether of good or evil; to look for with some confidence; to anticipate; -- often followed by an infinitive, sometimes by a clause (with, or without, that); as I expect to receive wages; I expect that the troops will be defeated.
    • Good: I will expect you. Shakespeare
    • Expecting thy reply. Shakespeare
    • The Somersetshire or yellow regiment ... was expected to arrive on the following day. Macaulay.
  2. to consider obligatory or required;
  3. to consider reasonably due;
    You are expected to get the task done by the end of next week.
  4. To wait for; to await.

Usage notes

  • Expect is a mental act and has always a reference to the future, to some coming event; as a person expects to die, or he expects to survive. Think and believe have reference to the past and present, as well as to the future; as I think the mail has arrived; I believe he came home yesterday, that he is he is at home now. There is a not uncommon use of expect, which is a confusion of the two; as, I expect the mail has arrived; I expect he is at home. This misuse should be avoided. Await is a physical or moral act. We await that which, when it comes, will affect us personally. We expect what may, or may not, interest us personally. See anticipate.
  • This is a catenative verb that takes the to infinitive. See Appendix:English catenative verbs

Translations

Derived terms

Anagrams

Extensive Definition

Expect is a Unix automation and testing tool, written by Don Libes as an extension to the Tcl scripting language, for interactive applications such as telnet, ftp, passwd, fsck, rlogin, tip, ssh, and others. With Tk, interactive applications can be wrapped in X11 GUIs.

Basics

Expect has regular expression pattern matching and general program capabilities, allowing simple scripts to intelligently control programs such as telnet, ftp, and ssh, all of which lack a programming language, macros, or any other program mechanism. The result is that Expect scripts provide old tools with significant new power and flexibility.

Examples

A simple example is a script that automates a telnet session:
# Assume $remote_server, $my_user_id, $my_password, and $my_command were read in earlier # in the script. # Open a telnet session to a remote server, and wait for a username prompt. spawn telnet $remote_server expect "username:" # Send the username, and then wait for a password prompt. send "$my_user_id\r" expect "password:" # Send the password, and then wait for a shell prompt. send "$my_password\r" expect "%" # Send the prebuilt command, and then wait for another shell prompt. send "$my_command\r" expect "%" # Capture the results of the command into a variable. This can be displayed, or written to disk. set results $expect_out(buffer) # Exit the telnet session, and wait for a special end-of-file character. send "exit\r" expect eof
Another example is a script that automates ftp:
# Open an ftp session to a remote server, and wait for a username prompt. spawn ftp $remote_server expect "username:" # Send the username, and then wait for a password prompt. send "$my_user_id\r" expect "password:" # Send the password, and then wait for an ftp prompt. send "$my_password\r" expect "ftp>" # Switch to binary mode, and then wait for an ftp prompt. send "bin\r" expect "ftp>" # Turn off prompting. send "prompt\r" expect "ftp>" # Get all the files send "mget *\r" expect "ftp>" # Exit the ftp session, and wait for a special end-of-file character. send "bye\r" expect eof

Usage

Expect serves as a "glue" to link existing utilities together. The general idea is to try to figure out how to make Expect utilize the system's existing tools rather than figure out how to solve a problem inside of Expect.
A key usage of Expect involves commercial software products. Many of these products provide some type of command-line interface, but these usually lack the power needed to write scripts. They were built to service the users administering the product, but the company often doesn't spend the resources to implement a fully robust scripting language. An Expect script can spawn a shell, look up environmental variables, perform some Unix commands to retrieve more information, and then enter into the product's command-line interface armed with the necessary information to achieve the user's goal. After looking up information inside the product's command-line interface, the script can make an intelligent decision about what action to take, if any.
Every time an Expect operation is completed, the results are stored in a local variable called $expect_out. This allows the script to both harvest information to feedback to the user, and it also allows conditional behavior of what to send next based on the circumstances.
A common use of Expect is to set up a testing suite, whether it be for programs, utilities or embedded systems. DejaGnu is a testing suite written using Expect for use in testing. It has been used extensively for testing gcc and is very well suited to testing remote targets such as embedded development.

Opinion

Pros

Expect can be run at regular intervals through the use of cron to encapsulate system administration tasks. This works because Expect merely uses system administration tools already located on the host computer. No extra tools need to be learned. If the programmer has already learned Tcl, then migrating to Expect is a relatively easy transition. The same programming structures and syntax exist, but with additional features built in.
There is large support in the industry for using Expect for many in-house administration tasks. It is widely used by companies such as Silicon Graphics, IBM, HP, Sun, Xerox, Amdahl, Tektronix, AT&T, ComputerVision and the World Bank to run in-house automated testing for development projects, file transfers, account administration, and network testing.
Expect has been ported to Python and Perl languages in various add-on module projects. A subset of Expect commands has been ported to Java and is embedded within SwitchTermJ (java-based Terminal Emulator) . Subroutines generally are an interpretation of the original version - with equivalent functionality. Once one understands the concept, one can trivially move to other languages as needed.

Cons

Expect inherits the same syntax convention as Tcl, which may seem unfamiliar if used to other script languages. Compared to languages such as bash, csh, and Perl, Expect has a different twist. It is sometimes challenging to remember when a variable must be prefixed with a "$", and when it must not. There are versions of Expect available for Perl and Python for those familiar with their syntax.
Another limitation is the difficulty in porting Expect scripts between platforms. For example, an Expect script that was written to use several Unix-based tools, might not be suitable if migrated to a Windows platform. If possible, the programmer must find counterpart command-line applications that provide the same information, and this will probably require changing the send/expect's, which can be a major part of the script. This is not an issue if you load tcl, perl or python on the machines in question, and use those languages' native POSIX interfaces for accessing files, and standard POSIX utilities (telnet, ftp etc.) for remote interaction.
Expect automates command-line tools, not GUI-based tools. While Windows offers many valuable tools, many are GUI-based and thus outside the reach of Expect. GUI programs in Windows can be automated with tools like Autohotkey or AutoIt.

References

expect in Polish: Expect
expect in Russian: Expect

Synonyms, Antonyms and Related Words

account as, anticipate, apprehend, approach, aspire to, assume, await, bank on, be afraid, be destined, be fated, be imminent, be to be, be to come, believe, come, come on, conceive, conclude, confide, conjecture, consider, contemplate, count, count on, daresay, deduce, deem, demand, desire, divine, draw near, draw on, dread, dream, envisage, envision, esteem, estimate, face, fancy, feel, feel confident, foreknow, foresee, foretell, gather, grant, guess, harbor the hope, have a hunch, have an idea, have an impression, have an inkling, have in mind, have in view, have the idea, hold, hold as, hope, hope against hope, hope and pray, hope for, hope in, hope to God, imagine, infer, judge, keep in view, lean upon, let, let be, lie ahead, live in hopes, look, look for, look forward to, look upon as, loom, maintain, near, need, nurture the hope, opine, plan, plot, predict, prefigure, presume, presuppose, presurmise, project, prophesy, provisionally accept, reckon, reckon on, regard, rely on, repute, require, rest assured, say, sense, set down as, suppose, surmise, suspect, take, take for, take for granted, take it, take to be, think, threaten, trow, trust, understand, view as, wait for, want, ween, wish
Privacy Policy, About Us, Terms and Conditions, Contact Us
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2
Material from Wikipedia, Wiktionary, Dict
Valid HTML 4.01 Strict, Valid CSS Level 2.1