pwsh 6.0 linux sftp wrapper

Welcome Forums General PowerShell Q&A pwsh 6.0 linux sftp wrapper

Viewing 2 reply threads
  • Author
    Posts
    • #187315
      Participant
      Topics: 16
      Replies: 14
      Points: 67
      Rank: Member

      When running running the following sftp command on RHEL 7, I get an error that I can't figure out how to avoid. Any suggestions.(I've also tried using &, and start-process)

      PS /home/brian> sftp fileprocd@dstrlaaa9504.dsglobal.org:/home/user < << $"put /mnt/c/b/user.txt" At line:1 char:54 + sftp fileprocd@dstrlaaa9504.dsglobal.org:/home/user < << $"put /mnt/c/ ... + ~ Missing file specification after redirection operator. At line:1 char:53 + sftp fileprocd@dstrlaaa9504.dsglobal.org:/home/user < << $"put /mnt/c/ ... + ~ The '<' operator is reserved for future use. At line:1 char:55 + sftp fileprocd@dstrlaaa9504.dsglobal.org:/home/user < << $"put /mnt/c/ ... + ~ Missing file specification after redirection operator. At line:1 char:54 + sftp fileprocd@dstrlaaa9504.dsglobal.org:/home/user < << $"put /mnt/c/ ... + ~ The '<' operator is reserved for future use. At line:1 char:55 + sftp fileprocd@dstrlaaa9504.dsglobal.org:/home/user <<< $"put /mnt/c/ ... + ~ The '<' operator is reserved for future use. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : MissingFileSpecification

    • #187324
      js
      Participant
      Topics: 26
      Replies: 702
      Points: 1,798
      Helping Hand
      Rank: Community Hero

      Is this one of the commands? Wow, this forum can't display 3 < 's in a row without a space.

      sftp fileprocd@dstrlaaa9504.dsglobal.org:/home/user < << $"put /mnt/c/b/user.txt"
      

      I'm not sure I understand it. There's no "< " operator in powershell. But you can pipe. Is that some kind of bash here string? That wouldn't be the same in powershell. How about:

      'put /mnt/c/b/user.txt' | sftp fileprocd@dstrlaaa9504.dsglobal.org:/home/user

    • #187330
      Participant
      Topics: 16
      Replies: 14
      Points: 67
      Rank: Member

      Yes it is a "here" string. I got the instructions from here.

      It appears that piping did work. Thank you for your help!

Viewing 2 reply threads
  • You must be logged in to reply to this topic.