PowerShell is a very interesting and powerful language, which also borrowed many aspects from Perl and some from Haskell.
- 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.
<update>
Example:
- if you do ls PATTERN | grep PATTERN in bash, you are piping a list of lines and you'll end in regexing relevant fields like file-size.
- In PS you'll transport a list of objects , e.g. the file-size is just an attribute of one of the file-objects
</update>
But in my experience it's not an intuitive DWIM hack like bash, mainly because the syntax is lengthy with "Verb-Noun Thing -options" structure
Example: To tail in PS you need Get-Content PATH.txt -Tail 10
They try to compensate this "wordy" structure with aliases for common commands like:
Standard Aliases for Get-Content: cat, type, gc
Though it still doesn't feel like CLI scripting (to me)
BUT: For many things PS is the only viable alternative.
My current strategy is to write Perl wrappers shelling out to PS.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.