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
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
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
Summary: hi, I'm altering a script from Unix to Linux, and I came across the Unix stat command - not the function, but the command. I know I had to get an rpm to run this in RedHat 8 - however, the unix comman...
Summary: I am using Unix sed command like this sed 's/XX/new.dat/' x > y.out The replacement is working fine but while creating the y.out file its truncating the last line from x file Any idea why this is ha...
Summary: Dev: It depends on how 'source code' and 'execuatable' are defined. You can say my source code is all files with an extension of .c or .h and use the find command: find . -type f \( -name "*.c" -o -n...