sponsored links

Collapse

Announcement

Collapse
No announcement yet.

sFTP and continuation character

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #46
    Does anyone know how to correct this error ? "extra characters after close-quote while compiling "send "PASSWORD"\n" invoked from within "expect -nobrace {userid@xxx.xxx.net's password:} {send "PASSWORD"\n}" }"

    I have tried tinkering but I don't see where the problem lies

    This is what I thought a pretty easy and standard function, log on to a remote server and I can't get that working, so frustrating.

    expect {
    "userid@xxx.xxx.net's password:" {send "PASSWORD"\n}
    }
    expect {
    "sftp>"
    }



    Comment


    • #47
      The \n needs to be inside the quotes.

      Code:
      {send "PASSWORD\n"}

      Comment


      • #48
        I did manage to get sFTP to work. I will say this, the "expect" syntax is unforgiving, quite confusing and a tad frustrating to use and I still don't really understand the bits and bytes of what is happening but I can work on that.

        I had a heck of a time just getting the script to log on to the remote server because of an invalid password.

        I managed to get it working by changing;

        expect {
        "Password:" {send "MYPASSWORD\n"}
        }

        to

        expect {
        "?assword:" {send "MYPASSWORD\n"}
        }

        It appears that the "?" is a wildcard so no matter what the remote server sends as text for the password prompt, e.g. "USER@JIM.server.net's Password:" The wild card ensures anything prior to "assword:" is ignored.

        I am able to log on to the remote server, change directory on the remote server, set the local directory and retrieve files from the remote server on to my iSeries IFS.

        I think I will be able to use this in our environment so thanks to RobertC and Scott for their input.
        Last edited by JimKerr; 5 days ago. Reason: Change wording.

        Comment

        sponsored links

        Collapse

        Working...
        X