Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^13: let Makefile.PL to do the Readme file for me -- new target? (Powershell)

by afoken (Chancellor)
on Jan 22, 2021 at 07:34 UTC ( [id://11127258]=note: print w/replies, xml ) Need Help??


in reply to Re^12: let Makefile.PL to do the Readme file for me -- new target? (Powershell)
in thread let Makefile.PL to do the Readme file for me -- new target?

PowerShell is a very interesting and powerful language, which also borrowed many aspects from Perl and some from Haskell.

I never worked with PowerShell, except for casting a few magic spells copied from Google results to make Windows behave.

  • Interesting b/c instead of piping text, they are piping objects (in the first draft the language was named "Monad")
  • Powerfull because these object have deep access into the OS and .NET-framework.

That should allow doing interesting things WITHIN the PowerShell/.NET walled garden. As long as you can use those objects, everything should be fine (except for bugs). But what about Unix-style interactions with other programs? Piping objects arounds surely is a powerful concept, but can I stuff binary data from STDOUT of tool A into a pipe, then filter it through B, C, D, and finally have E process the result of filtering? (In other words, what's the equivalent of a bash on Unix doing A -foo -bar | B -bla bla | C --what=ever | D ./magic ./stuff  | E +gnarf)

What about networking? I often do things like this:

tar -C /some/where -cf - subtree | ssh root@embedded.system tar -C /else/where -xvf - > copied.txt 2> problems.txt

(Create a tar archive of subtree in /some/where and write to STDOUT, have ssh pass that byte stream to another tar instance running as root on embedded.system as STDIN, make that second tar extract the archive to /else/where, write STDOUT of the second tar to copied.txt on the local system, and STDERR to problems.txt on the local system.)

What about quoting? Quoting the two redirections in the previous command would write STDOUT and STDERR of the second tar to embedded.system, because ssh implicitly invokes a shell on embedded.system:

tar -C /some/where -cf - subtree | ssh root@embedded.system tar -C /else/where -xvf - '>' copied.txt '2>' problems.txt

How to pass things like ", ', <, >, | as arguments? On Unix:

echo '"' "'" \< ">" "|"

Expanding variables, and passing parameters that just look like variable expansions?

echo '$PATH' "expands to \"$PATH\""

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^14: let Makefile.PL to do the Readme file for me -- new target? (Powershell)
by LanX (Saint) on Jan 22, 2021 at 08:10 UTC
    Well... Tell me! :)

    With the exception of ssh all of this should be possible, Win has another approach here.

    update

    Looks like win10 comes with a ssh server. Haven't used it yet.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11127258]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2024-03-29 13:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found