ibmi-brunch-learn

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; August 15, 2019, 04:28 PM. Reason: Change wording.

        Comment


        • #49
          Jim,
          I have been away from the forum for a while but wanted to check in to see how you were doing. It's good to see that you got SFTP to work. You are so right about the Expect syntax. It is unforgiving indeed but Scott is very good with that and I see he was able to help you as well. I don't know about you but I had never worked with shell scripts before. I found it to be very interesting. Frustrating at times, but interesting nonetheless.
          Last edited by RobertC; August 21, 2019, 03:16 PM.

          Comment


          • #50
            Robert,
            I am still dabbling (and procrastinating!) with sFTP. I want to use sFTP as it would be more efficient than juggling the files using Filezilla. I also have Cleo LexiCom installed on the iSeries which will also do the job of fetching/putting files across servers. Automation is my sticking point whether I use sFTP or LexiCom. It needs a fair bit of work to get it all flowing reliably.

            And since sFTP doesn't appear to support the transfer of DB2 /qgpl.lib/myfile.file/myfile.mbr it's another step to get the file into the IFS before I can sFTP to the customer server.

            Comment


            • #51
              This is strange, where am I going wrong ?

              I want to retrieve multiple files from the remote server. I only want to retrieve files that are type .txt. It seems the command "get *.txt\n" (or even "mget *.txt\n) would work but it doesn't.

              There are four files on the remote server, a.txt , b.edi, c.edi and d.pdf. Three of the files are retrieved, a.txt, b.edi and d.pdf.

              The log shows "fetching /outbound a.txt to a.txt." i.e no reference to any of the other files. No apparent errors.

              What is up with that ?!

              Comment


              • #52
                Hello,
                I have been configuring SFTP and it works great on our IBMi. However upon delivery to a customer when the below script is executed we receive the below error:

                001-0050 Syntax error on line 1: token ")" not expected.

                The script is as follows:

                PATH=£PATH:/usr/local/bin && expect -f /Aquatmp/exp_236953.inp

                Has anyone experienced this issue before? I am guessing its a character translation issue. Perhaps an issue with the installation of EXPECT tool?
                Any help would be much appreciated!

                Thanks!

                Comment

                Working...
                X