Share on Facebook Share on Twitter Email
Answers.com

expect

 
(ĭk-spĕkt') pronunciation

v., -pect·ed, -pect·ing, -pects.

v.tr.
    1. To look forward to the probable occurrence or appearance of: expecting a telephone call; expects rain on Sunday.
    2. To consider likely or certain: expect to see them soon. See Usage Note at anticipate.
  1. To consider reasonable or due: We expect an apology.
  2. To consider obligatory; require: The school expects its pupils to be on time.
  3. Informal. To presume; suppose.
v.intr.
  1. To look forward to the birth of one's child. Used in progressive tenses: His sister is expecting in May.
  2. To be pregnant. Used in progressive tenses: My wife is expecting again.

[Latin exspectāre : ex-, ex- + spectāre, to look at, frequentative of specere, to see.]

expectable ex·pect'a·ble adj.
expectably ex·pect'a·bly adv.
expectedly ex·pect'ed·ly adv.
expectedness ex·pect'ed·ness n.

SYNONYMS   expect, anticipate, hope, await. These verbs relate to the idea of looking ahead to something in the future. To expect is to look forward to the likely occurrence or appearance of someone or something: "We should not expect something for nothing-but we all do and call it Hope" (Edgar W. Howe). Anticipate sometimes refers to taking advance action, as to forestall or prevent the occurrence of something expected or to meet a wish or request before it is articulated: anticipated the attack and locked the gates. The term can also refer to having a foretaste of something expected: anticipate trouble. To hope is to look forward with desire and usually with a measure of confidence in the likelihood of gaining what is desired: I hope to see you soon. To await is to wait expectantly and with certainty: eagerly awaiting your letter.


Search unanswered questions...
Enter a question here...
Search: All sources Community Q&A Reference topics

was the object of much criticism during the 19th century when it was used to mean 'to suppose, surmise', as in I expect you'd like a drink. Fowler, however, regarded it as a natural extension of meaning and wrote (1926) that 'it seems needless purism to resist it'. This view has been supported by the weight of usage, especially in spoken English.
An Asda checkout worker was celebrating after she and her partner scooped a £12.8m Lotto win....A colleague at Asda said:... 'I don't expect she'll be coming back here.'—Liverpool Daily Post, 2005.

Previous:expandable, expansible, exoteric, exotic, exorcize
Next:expedience, expediency, expiry, expiration, expletive
Roget's Thesaurus:

expect

Top

verb

  1. To look forward to confidently: anticipate, await, bargain for (or on), count on, depend on (or upon), look for, wait (for). Informal figure on. See surprise/expect.
  2. To oblige to do or not do by force of authority, propriety, or custom: require, suppose. See obligation.


v

Definition: anticipate
Antonyms: despair of, lose faith in

v

Definition: wish
Antonyms: dread, fear

Word Tutor:

expect

Top
pronunciation

IN BRIEF: To look forward to as certain or probable.

pronunciation I expect to see you very soon.

LearnThatWord.com is a free vocabulary and spelling program where you only pay for results!

sign description: Both hands make a bending motion as they are held up by the head.




When transmitted on radio, it means to expect the stated item (e.g., landing runway, onward clearance, delays). This does not imply clearance, but it is meant for further planning.

In statistics refers to the expectation as predicted by the relevant formula or model.

  • e. frequency — see expected frequency.
  • e. value — see expected value.
Random House Word Menu:

categories related to 'expecting'

Top
Random House Word Menu by Stephen Glazier
For a list of words related to expecting, see:

  See crossword solutions for the clue Expect.
Expect
Original author(s) Don Libes
Stable release 5.44.1.15 / March 11, 2010; 21 months ago (2010-03-11)
Written in Tcl
Operating system POSIX, Windows
License Public domain[1]
Website http://expect.nist.gov/

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. It uses Unix pseudo terminals to wrap up subprocesses transparently, allowing the automation of arbitrary applications that are accessed over a terminal. With Tk, interactive applications can be wrapped in X11 GUIs.

Contents

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:

# Set timeout parameter to a proper value.
# For example, the file size is indeed big and the network speed is really one problem, you'd better set this parameter a value.
set timeout -1
# 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

Below is an example that automates sftp, with password:

#!/usr/local/bin/expect -f #<---insert here your expect program location
 
# procedure to attempt connecting; result 0 if OK, 1 otherwise
proc connect {passw} {
  expect {
    "Password:" {
      send "$passw\r"
        expect {
          "sftp*" {
            return 0
          }
        }
    }
  }
  # timed out
  return 1
}
 
#read the input parameters
set user [lindex $argv 0]
set passw [lindex $argv 1]
set host [lindex $argv 2]
set location [lindex $argv 3]
set file1 [lindex $argv 4]
set file2 [lindex $argv 5]
 
#puts "Argument data:\n";
#puts "user: $user";
#puts "passw: $passw";
#puts "host: $host";
#puts "location: $location";
#puts "file1: $file1";
#puts "file2: $file2";
 
#check if all were provided
if { $user == "" || $passw == "" || $host == "" || $location == "" || $file1 == "" || $file2 == "" }  {
  puts "Usage: <user> <passw> <host> <location> <file1 to send> <file2 to send>\n"
  exit 1
}
 
#sftp to specified host and send the files
spawn sftp $user@$host
 
set rez [connect $passw]
if { $rez == 0 } {
  send "cd $location\r"
  set timeout -1
  send "put $file2\r"
  send "put $file1\r"
  send "ls -l\r"
  send "quit\r"
  expect eof
  exit 0
}
puts "\nError connecting to server: $host, user: $user and password: $passw!\n"
exit 1

another example of automated ssh login in user machine

#timeout is predefine variable in expect which is default set to 10 sec
#spawn_id is another default variable in expect. It is good practice to close spawn_id handle created by spawn command
set timeout 60 
spawn ssh $user@machine
while {1} {
  expect {
 
    eof                          {break}
    "The authenticity of host"   {send "yes\r"}
    "password:"                  {send "$password\r"}
    "*\]"                        {send "exit\r"}
  }
}
wait
close $spawn_id

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 fully implement a 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 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.

You can automate the generation of an expect script using a tool called 'autoexpect'. This tool observes your actions and generates an expect script using heuristics. Though generated code may be large and somewhat cryptic, you can always tweak the generated script to get the exact code.

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, Perl and Java languages in various add-on module projects. 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 accustomed 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.[2][3]

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/expects, 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.

A less obvious argument against Expect is that it can enable sub-optimal solutions. For example, a systems administrator needing to log into multiple servers for automated changes might use Expect with stored passwords, rather than the better solution of ssh agent keys. The ability to automate interactive tools is attractive, but there are frequently other options that can accomplish the same tasks in a more robust manner.

Expect cannot automate GUI based tools. This is generally only a problem on Windows where for many tasks a GUI based interface is the only option. In these situations tools like Autohotkey, AutoIt or Winbatch can be used instead.

References

Further reading

  • Libes, Don (1995). Exploring Expect: A Tcl-Based Tool for Automating Interactive Programs. O'Reilly & Associates, Inc. ISBN 1-56592-090-2. 

External links


Misspellings:

expects

Top

Common misspelling(s) of expects

  • spects

Translations:

Expect

Top

Dansk (Danish)
v. tr. - forvente, antage, vente sig
v. intr. - være gravid

Nederlands (Dutch)
verwachten, rekenen op, in verwachting zijn, vermoeden, aannemen

Français (French)
v. tr. - s'attendre à, prévoir, escompter, compter sur, espérer, penser, croire, supposer, se douter de, exiger, attendre (qch de qn), demander (qch à qn), attendre (qn, qch), attendre (un bébé)
v. intr. - s'attendre à, être enceinte

Deutsch (German)
v. - erwarten

Ελληνική (Greek)
v. - αναμένω, περιμένω, προσμένω, προσδοκώ, προσβλέπω, απαιτώ, σκέπτομαι, φρονώ, ελπίζω, υποθέτω, πιστεύω, φαντάζομαι, (μτφ.) είμαι έγκυος, περιμένω παιδί

Italiano (Italian)
aspettarsi, aspettare, sperare, supporre, presumere

Português (Portuguese)
v. - esperar, prever

Русский (Russian)
ожидать, рассчитывать, надеяться

Español (Spanish)
v. tr. - contar con, presumir, suponer, esperar
v. intr. - estar embarazada

Svenska (Swedish)
v. - vänta, vänta sig, anta

中文(简体)(Chinese (Simplified))
预期, 期待, 盼望, 怀孕, 怀胎

中文(繁體)(Chinese (Traditional))
v. tr. - 預期, 期待, 盼望
v. intr. - 期待, 懷孕, 懷胎, 預期

한국어 (Korean)
v. tr. - 기대하다
v. intr. - 임신 중이다

日本語 (Japanese)
v. - 予期する, 待ちうける, 期待する, 思う

العربيه (Arabic)
‏(فعل) يتوقع‏

עברית (Hebrew)
v. tr. - ‮ציפה, קיווה, שיער‬
v. intr. - ‮היתה בהיריון‬


 
 

 

Copyrights:

American Heritage Dictionary. The American Heritage® Dictionary of the English Language, Fourth Edition Copyright © 2007, 2000 by Houghton Mifflin Company. Updated in 2009. Published by Houghton Mifflin Company. All rights reserved.  Read more
 Fowler's Modern English Usage. Oxford University Press. © 1999, 2004 All rights reserved.  Read more
Roget's Thesaurus. Roget's II: The New Thesaurus, Third Edition by the Editors of the American Heritage® Dictionary Copyright © 1995 byHoughton Mifflin Company. Published by Houghton Mifflin Company. All rights reserved.  Read more
Answers Corporation Antonyms by Answers.com. © 1999-present by Answers Corporation. All rights reserved.  Read more
Word Tutor. Copyright © 2004-present by eSpindle Learning, a 501(c) nonprofit organization. All rights reserved.
eSpindle provides personalized spelling and vocabulary tutoring online; sign up free Read more
Sign Language Videos. Copyright © 2009 Signing Savvy, LLC. All rights reserved.  Read more
McGraw-Hill Dictionary of Aviation. An Illustrated Dictionary of Aviation.. Copyright © 2005 by McGraw-Hill Companies, Inc. All rights reserved.  Read more
Saunders Veterinary Dictionary. Saunders Comprehensive Veterinary Dictionary 3rd Edition. Copyright © 2007 by D.C. Blood, V.P. Studdert and C.C. Gay, Elsevier. All rights reserved.  Read more
Random House Word Menu. © 2010 Write Brothers Inc. Word Menu is a registered trademark of the Estate of Stephen Glazier. Write Brothers Inc. All rights reserved.  Read more
 Rhymes. Oxford University Press. © 2006, 2007 All rights reserved.  Read more
Bradford's Crossword Solver's Dictionary. Collins Bradford's Crossword Solver's Dictionary © Anne Bradford, 1986, 1993, 1997, 2000, 2003, 2005, 2008 HarperCollins Publishers All rights reserved.  Read more
Wikipedia on Answers.com. This article is licensed under the Creative Commons Attribution/Share-Alike License. It uses material from the Wikipedia article Expect Read more
Answers Corporation Misspellings. © 1999-present by Answers Corporation. All rights reserved.  Read more
Translations. Copyright © 2007, WizCom Technologies Ltd. All rights reserved.  Read more

Follow us
Facebook Twitter
YouTube