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

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

unix expect-command

Reply to Message Icon

Original Message
Name: Jernand
Date: December 20, 2004 at 17:02:38 Pacific
Subject: unix expect-command
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


Report Offensive Message For Removal


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

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.


Report Offensive Follow Up For Removal

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

Thanks Nails!!

Regards,
Jern


Report Offensive Follow Up For Removal







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








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge
Poll History




Data Recovery Software