Skip to content
  • Uros @Urosch ·

    When running the script I get: wrong # args: should be "while test command" while executing "while { expect "Password:" { stty -echo expect_user -re "(.*)\n" send "$expect_out(1,string)\n" stty echo expect "Are you OK with..." (file "./ssl-renewal.ex" line 20)

    On line 20 of ssl-renew there is only "while true {" Could you help debug this? Thanks in advance ;)

  • Andy Mayhew @shackledtodesk ·

    Interesting. I've not seen this error before. Can you confirm the version of expect and OS you are using? My only other thought it that line 19 "Are you OK with your IP being logged?" { send "y\r" } is a continuation of line 18, hence line 18 must end with \ with no trailing characters.

  • Uros @Urosch ·

    Version of Expect is 5.45, OS is Mac OS Sierra 10.12.5. And the line is actually 11, not 20 as stated previously...

  • Andy Mayhew @shackledtodesk ·

    The only thing I can see, is that on line 11, it should read while true { and in your initial comment the true is missing.

    You wrote:

    When running the script I get: wrong # args: should be "while test command" while executing "while { expect "Password:" { stty -echo expect_user -re "(.*)\n" send

    and the code in that section should be

    while true {
    expect "Password:" {
        stty -echo
        expect_user -re "(.*)\n" 
        send "$expect_out(1,string)\n"
        stty echo
        expect "Are you OK with your IP being logged?" { send "y\n" }
    } \
    "Are you OK with your IP being logged?" { send "y\r" }
    ```
  • Jordy van Dortmont @jordyvandortmont ·

    Thanks for creating this script!

    Unfortunately I'm getting the same error.

    spawn certbot certonly --config certbot.ini -a manual --debug
    wrong # args: should be "while test command"
        while executing
    "while true {
    expect "Password:" {
        stty -echo
        expect_user -re "(.*)\n"
        send "$expect_out(1,string)\n"
        stty echo
        expect "Are you OK ..."
        (file "ssl-renewal.ex" line 11)
    Edited by Jordy van Dortmont
  • Andy Mayhew @shackledtodesk ·

    Hey, apologies for basically dropping this. Day job got in the way. In the mean time, I've figured out a better, simpler way to automate certbot without resorting to convoluted expect scripts.

    Updated article and snippet

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment