expect gets hung

From: Mohammed Riyaz (p_mdriyaz_at_sify.com)
Date: 12/31/04

  • Next message: Spam: "Re: ANNOUNCE: Tcl/Tk 8.4.9 rpm specification with thread 2.6 extension"
    Date: 31 Dec 2004 04:48:50 -0800
    
    

    Hi,
    I am having problems with a simple expect program for passwd.

    #!/usr/bin/expect
    spawn passwd [lindex $argv 0]
    set password [lindex $argv 1]
    expect "*password:"
    send "$password \r"
    expect "*password:"
    send "$password \r"
    expect eof

    when i run this program with ./test riyaz 7sd8990ad

    i get the following output

    spawn passwd riyaz
    Changing password for user riyaz.
    New password: 7sd8990ad
     
    Retype new password:
    $

    after displaying New password: 7sd8990ad the program waits for
    sometime (a couple of seconds) and then Retype new password appears
    and then again waits for sometime and then the prompt appears. But the
    password does not change. Could somebody help me out with this.

    i even tried with #!/usr/bin/expect -f, i also tried with \n instead
    of \r
    i am using version 5.39.0

    Thank you,
    Mohammed Riyaz P.


  • Next message: Spam: "Re: ANNOUNCE: Tcl/Tk 8.4.9 rpm specification with thread 2.6 extension"

    Relevant Pages

    • expect : passwd problem
      ... set password [lindex $argv 1] ... spawn passwd ... #./pass1 steph steph ...
      (Debian-User)
    • problem with expect
      ... set old_password [lindex $argv 2] ... spawn passwd ... expect "UNIX password: $" ...
      (Debian-User)
    • Re: add users from a text file
      ... Here a little script that might help with a bit of adaption. ... spawn passwd [lindex $argv 0] ...
      (RedHat)