5 ms·
PowerShell, mostly because PowerShell was designed as a mashup of Bash and C#.... And it's kind of a trainwreck in a lot of ways. It really feels like piping a
by Pxtl 7y ago
PowerShell, mostly because PowerShell was designed as a mashup of Bash and C#.... And it's kind of a trainwreck in a lot of ways.
It really feels like piping and easy process invocation and compile-time directory awareness wouldn't be massively onerous to add to an existing full-featured programming language so you wouldn't have to sacrifice a good type system and powerful syntax when you want to do scripty things.
- edgyquant 7y agoRight. Powershell is a shell though not a programming language.
- plapetomain 7y agoThat is false. Why do you think it is not a programming language?
- chrisfinazzo 7y agoAs I understand it, PowerShell came about because porting the standard Linux/Unix utilities to Windows didn't work out. PowerShell meets both requirements as it's tuned for the Windows environment, but can still play nicely with the rest of the world. Of course, now that WSL is a thing, it's a real question why someone would want to use PS unless they had no other options. https://www.heavybit.com/library/podcasts/to-be-continuous/ep-37-the-man-behind-windows-powershell/ https://www.heavybit.com/library/podcasts/to-be-continuous/e...
- sjy 7y agoPowerShell has real data structures (arrays and hash tables), built-in functional programming tools (Select-Object, ForEach-Object, Where-Object), GUI cmdlets (Out-GridView) and direct access to .NET libraries. It’s a viable tool for many complex tasks where on Unix, you’d need to reach for Python rather than a shell.
- vips7L 7y ago>Of course, now that WSL is a thing, it's a real question why someone would want to use PS unless they had no other options. I use it because I only have to learn one tool, and not a ton of different ones with different UX. The 'language' is sane, at least to me, as it's object oriented doesn't revolve around parsing strings.
- heavyset_go 7y agoSome of the features of PowerShell seem really enticing, and I wish they would make their way over to Unix-like shells. Unfortunately, I don't know how much utility I'd get out of PowerShell on Linux, so I haven't tried it. edit: your comment inspired me so I installed PowerShell via Snap and am going to give it a go on Linux.
- Pxtl 7y agoTo me PowerShell mixes easy access to command-line tools and higher-order object-oriented map/filter style functions. The mix between Unix-style piping from command-line tools and modern object-y mapping and filtering can feel like a dream. That's the good part. The bad part is that it's easily one of the wartiest languages I've ever used, especially as a young language it's really got an inexcusable amount of legacy problems. A colleague of mine (who also uses it heavily) says "two Googles per line". Just to get sane parameter and variable checking you have to throw up a bunch of attributes and set a bunch of flags. Be sure to set up strict mode, use cmdletbinding on your parameter blocks, and set ErrorActionPreference to "stop" in every script you write. That and the quality of many of the first-party official PowerShell modules is appallingly low by Microsoft standards. The good side is that the .NET framework is accessible so whenever the PowerShell module is failing you, you can drop down into leveraging raw c#-style assemblies, which are much higher quality but they speak PowerShell with a very thick accent. But I'm using it on Windows, YMMV on Linux. I'm infatuated with the concept, but the implementation leaves a lot to be desired.