Ask a Question related to AIX, Design and Development.

  1. #1

    Default EXPECT Utility

    Hi,

    I am trying to pass a password which is having special characters like
    $$.

    If I pass a password like "test$$12" as a new password, the program
    cannot able to set the password as "test$$12". How to nullify the
    special meaning of "$$" while passing the argument. Here is my
    program.

    #!/usr/bin/expect -f

    spawn /usr/bin/passwd

    set oldpas [lindex $argv 0]
    set newpas [lindex $argv 1]

    expect "Old password:"
    send "$oldpas\r"
    expect "New password:"
    send "$newpas\r"
    expect "new password:"
    send "$newpas\r"
    expect eof

    Thanks in advance for your help.

    Best Regards
    Siva.
    Krishna Guest

  2. Similar Questions and Discussions

    1. Expect and rsh
      Hello, I have an expect script that I use to telnet into a remote machine to execute unix commands. My question is not about using expect to do...
    2. [PHP-DEV] When can I expect changes to be applied
      Hello, I requested some time ago that zend_parse_parameters() be altered to accept "Z" as a parameter type in order to be able to retrieve...
    3. Net::SCP::Expect
      Would someone mind telling me what I am doing wrong here please. I am trying to tie the SCP Expect module into a backup script I put together, but it...
    4. Expect problem
      The following Expect script works fine: #!/usr/local/bin/expect #exp_internal 1 #log_file "lon.txt" spawn telnet 199.169.71.190 2003 exec...
    5. @INC is not what I expect
      I have this perl script running on solaris in korn: $ cat scriptb.sh #!/usr/bin/perl use strict; use DBI; these are my included library...
  3. #2

    Default Re: EXPECT Utility

    [email]haisiva@yahoo.com[/email] (Krishna) writes:
    > Hi,
    >
    > I am trying to pass a password which is having special characters like
    > $$.
    >
    > If I pass a password like "test$$12" as a new password, the program
    > cannot able to set the password as "test$$12". How to nullify the
    > special meaning of "$$" while passing the argument. Here is my
    > program.
    I haven't used expect, but if it's like shell scripting, try ${oldpas}
    as the reference instead of $oldpas.

    This avoids this very problem in the shell scripting world, and may
    well work for you.
    > #!/usr/bin/expect -f
    >
    > spawn /usr/bin/passwd
    >
    > set oldpas [lindex $argv 0]
    > set newpas [lindex $argv 1]
    >
    > expect "Old password:"
    > send "$oldpas\r"
    > expect "New password:"
    > send "$newpas\r"
    > expect "new password:"
    > send "$newpas\r"
    > expect eof
    --
    Todd H.
    [url]http://www.toddh.net/[/url]
    Todd H. Guest

  4. #3

    Default Re: EXPECT Utility


    "Krishna" <haisiva@yahoo.com> wrote in message
    news:1d5a6364.0309291159.7adcea73@posting.google.c om...
    > Hi,
    >
    > I am trying to pass a password which is having special characters like
    > $$.
    >
    > If I pass a password like "test$$12" as a new password, the program
    > cannot able to set the password as "test$$12". How to nullify the
    > special meaning of "$$" while passing the argument. Here is my
    > program.
    >
    > #!/usr/bin/expect -f
    >
    > spawn /usr/bin/passwd
    >
    > set oldpas [lindex $argv 0]
    > set newpas [lindex $argv 1]
    >
    > expect "Old password:"
    > send "$oldpas\r"
    > expect "New password:"
    > send "$newpas\r"
    > expect "new password:"
    > send "$newpas\r"
    > expect eof
    >
    > Thanks in advance for your help.
    >
    comp.lang.tcl is the NG best suited to this query as Expect uses
    embedded tcl.
    Mr Libes hangs out there as well.

    RobH





    RobH Guest

  5. #4

    Default Re: EXPECT Utility

    On 29 Sep 2003 12:59:24 -0700, [email]haisiva@yahoo.com[/email] (Krishna) wrote:
    >Hi,
    >
    >I am trying to pass a password which is having special characters like
    >$$.
    >
    >If I pass a password like "test$$12" as a new password, the program
    >cannot able to set the password as "test$$12". How to nullify the
    >special meaning of "$$" while passing the argument. Here is my
    >program.
    >
    >#!/usr/bin/expect -f
    >
    >spawn /usr/bin/passwd
    >
    >set oldpas [lindex $argv 0]
    >set newpas [lindex $argv 1]
    >
    >expect "Old password:"
    >send "$oldpas\r"
    >expect "New password:"
    >send "$newpas\r"
    >expect "new password:"
    >send "$newpas\r"
    >expect eof
    >
    >Thanks in advance for your help.
    >
    >Best Regards
    >Siva.
    When invoking the script and passing your password(s) preceed every
    special character with a backslash "\". This will escape the special
    characters and send them, intact, to the subscript.

    Bob
    at Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139