5 ms·
PowerShell is really good. Like, amazingly good.
by dooopy 4y ago
PowerShell is really good. Like, amazingly good.
- xnorswap 4y agoYes, I find it odd how there's a massive blind spot when it comes to powershell. Proponents of strong typing everywhere in their programming languages are put off by a shell that dares pipe objects rather than having everything as strings. I get that Unix has a long tradition and it's hard to change, but powershell is genuinely a modern shell that while uncomfortably verbose without aliases is extremely powerful and feels modern.
- majkinetor 4y agoIt blows my mind too. Typical verbosity argument is nonsense - people should use aliases. With cross platform shell, first time we have some reason not to use them, to make script more portable. Besides, this verbosity is form of documentation - you really must consider that any bash script comes with invisible man that you usually must check even after years of usage. When you factor that in, even fully verbose PowerShell is joy. Most of Unix haters seem to bi bigots. I have never seen good argument against PowerShell, apart of that it could be faster for specific use cases.
- tgv 4y agoIt seems like the powershell occupies a different niche than sh/bash, etc. It seems more oriented towards manipulating system properties than sorting and grepping. At least, the examples are always about system objects and properties. I wouldn't even know how to integrate normal unix commands in the powershell. Things like this look pretty counter-intuitive: https://devblogs.microsoft.com/commandline/integrate-linux-commands-into-windows-with-powershell-and-the-windows-subsystem-for-linux/ https://devblogs.microsoft.com/commandline/integrate-linux-c...
- majkinetor 4y agoSorting and grepping in PowerShell are an every-day trivial thing. I even use it to as data analytics tool to query moderate amount of data because its just simpler then using anything else (given that ConvertFromTo-XML,Json,Csv etc. are integrated, standard, and don't require bunch of other tools like jq, miler etc.) and I can send it to anybody along with the data to reproduce it or tweak it without having to install anything or learn any new language. > At least, the examples are always about system objects and properties Not sure where you get that idea from. Third party examples are not important at all. Majority of usage has nothing to do with the system and its properties. Not sure why you mentioned that particular method of invoking WSL stuff. If anything, it shows how powerful PowerShell is.
- usrbinbash 4y ago> I have never seen good argument against PowerShell As long as I have to type `Get-Content` instead of `cat`, that's argument enough for me.
- majkinetor 4y agoBut you can - `cat` is alias to Get-Content (one of). Better, use `gc` Its shorter then `cat` and almost immediately guessable what it does if you know that aliases in pwsh are also named by the standard. "Cat" on the other hand has almost nothing to do with original intent (I am not concatenating stuff, I am getting a content so, the problem with that name is the same as with "magic numbers" in general programming)
- bzxcvbn 4y agoGood news: cat is a built-in alias for Get-Content in powershell.
- oblio 4y agoThis is first level ignorance. Which is super amusing when coming from folks that otherwise pride themselves on reading long and dry manuals. PowerShell has aliases. And it comes with a ton of them already defined, they're even listed in the command help page. Get-Content is gc. Heck, Get-Content is even cat.
- bzxcvbn 4y agoI think a lot of it boils down to knee-jerk reactions about MS products. When I speak of powershell with colleagues, their first reaction is usually "I couldn't use a non-free shell!"... Even though powershell has been MIT licensed and open source for years now. As for the verbosity, this isn't a good argument. In my mind there are two "modes" of powershell: * Day to day shell use, which should definitely use aliases. Nobody wants to type Get-ChildItem to get the list of files in a folder ten times in a row. * Script writing, which should use the long form of commands. Any good text editor (e.g. vscode does it) should be able to translate aliases into long form commands. I think they really hit the sweet spot when considering these two aspects. Long scripts are readable without referring to manpages all the time, while day to day shell is quick and easy.
- majkinetor 4y ago> Any good text editor (e.g. vscode does it) should be able to translate aliases into long form commands. It can be done with script Expand-Alias[1] that can be used even as CI/CD action so people don't have to think about this. I prefer to look into longer code in its aliased form..... mhm... we definitely need Unexpanding... [1]: https://github.com/WormieCorp/Wormies-AU-Helpers/blob/develop/Wormies-AU-Helpers/public/Expand-Aliases.ps1 https://github.com/WormieCorp/Wormies-AU-Helpers/blob/develo...