LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   is it possible in expect script (https://www.linuxquestions.org/questions/programming-9/is-it-possible-in-expect-script-775672/)

packets 12-14-2009 07:30 PM

is it possible in expect script
 
I created a script wherein it will change password of a user

Quote:

#!/usr/bin/expect


spawn passwd [lindex $argv 0]
set password [lindex $argv 1]
expect "New UNIX password:"
send "$password\r"
expect "Retype new UNIX password:"
send "$password\r"
expect eof
My simple but noob question is can I run this script without any output. What I mean is run the script in quite mode. I don't want to output anything when I run the script. When I run the script, it output the messages found on passwd.

jlinkels 12-14-2009 07:51 PM

Put the statement
log_user 0
at the point where you don't want to see any output.

Before putting that in, put
exp_internal 1
at the start of the program to enable debugging. Remove it if your program is running correctly.

jlinkels

packets 12-14-2009 08:01 PM

@jlinkels

Thanks! you make my day bright hhahaha I really love open source community


All times are GMT -5. The time now is 11:32 PM.