Computing.Net > Forums > Unix > unix expect-command

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

unix expect-command

Reply to Message Icon

Name: Jernand
Date: December 20, 2004 at 17:02:38 Pacific
OS: hp-ux
CPU/Ram: 1280mb
Comment:

Hi,

Could somebody plz tell me where the command "expect" is used. and wud appreciate if you can write a simple standalone script that uses this command. thanks

Regards,
Jern



Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: December 20, 2004 at 19:55:07 Pacific
Reply:

Hi:

Expect is a tool for automating interactive applications. While it's available on most Linux systems, you typically have to download it for other systems. Here's the expect home page:

http://expect.nist.gov

The most common example is automating the passwd command which is impossible from the shell:

#!/usr/local/bin/expect --
# wrapper to make passwd(1) be non-interactive
# username is passed as 1st arg, passwd as 2nd
# Executable only by root
set password [lindex $argv 1]
spawn /usr/bin/passwd [lindex $argv 0]
expect "password:"
send "$password\r"
expect "password:"
send "$password\r"
expect eof
# end script

An excellent book is Exploring Expect by Don Libes.


0

Response Number 2
Name: Jernand
Date: December 21, 2004 at 09:05:07 Pacific
Reply:

Thanks Nails!!

Regards,
Jern


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: unix expect-command

Unix stat command www.computing.net/answers/unix/unix-stat-command/5869.html

Unix sed command problem www.computing.net/answers/unix/unix-sed-command-problem/5822.html

unix command help www.computing.net/answers/unix/unix-command-help/6321.html