by electricEmu · 5y ago · 0 comments
There are good choices in 2021.
https://docs.microsoft.com/en-us/powershell/scripting/instal...
That latter point is, in my opinion, the biggest hurdle to using PowerShell.
Of course, it ultimately boils down to personal preference and for some, .NET support is a killer feature.
In my experience, there is a graveyard of tools that I tried which attempted to create native POSIX ports for Windows. Each port came up short in my workflow every time. PowerShell and WSL provide me and the teams I work with an experience that simply works.
Get-Foo | % { $_.bar() }
Which is roughly equivalent to e.g. python map(lambda x: x.bar(), getFoo())
Does murex have anything like that? Generally serializing objects (with methods) is to byte streams is not trivial nor without tradeoffs Get-Foo | [ bar ] | source
would be the equivalent murex code.PowerShell is definitely more sophisticated here because .bar is recognised as a method. Whereas in murex it's just a text field that you're asking the interpreter to execute as code.
As mentioned to one of your other replies, this causes a few issues (eg forking). But processes are still run in parallel like with a traditional shell and 99% of time this massive cheat is transparent to both the running processes and the users too.
This cheat does allow for some additional features though, like
- colourisation of STDERR (so it stands out)
- STDERR byte count used to judge if a process has failed
(possibly a few others I've forgotten but have to dash now for a lockdown Zoom party....sorry)
In the following example, 'choco' (Chocolatey) outputs a list of outdated packages in a consistent format (--limit-output). The text output is piped to the ConvertFrom-CSV PowerShell CmdLet, which maps the text output from choco into a PowerShell object.
```ps1 choco outdated --limit-output | ConvertFrom-csv -Delimiter '|' -Header 'name','version','v-new','pin' ```
For what it's worth, STDERR is already colorized in PowerShell too.