I dev on a Mac and do a lot of 'quality of life' scripting with Bash. I recently had to do something on a PC and figured I'd try out Powershell. I have to say, it was a joy. Dealing with objects instead of text is so refreshing, it really is a game changer especially when you start integrating with COM (e.g. excel). The only things I found worse: 1 - error handling doesnt bubble in the same way. e.g. I can't do an eq…
Linux Bash vs. Windows PowerShell
41–50 of 93 posts
Re: Linux Bash vs. Windows PowerShell
#42I hate how long the PowerShell comand names are. Yes they are sensible but arg. Eg grep vs Select-String as the article mentions.
It is recommended that you use full names in scripts for readability reasons so most script examples on the web have those long obnoxious names.
Also, tab completion works really well with command argument names so in practice it's not that many keystrokes.
Re: Linux Bash vs. Windows PowerShell
#43I think PowerShell doesn’t really compete with Bash, it competes with Python, Perl or the like. And I haven’t found it to be superior in that aspect other than at integration with Windows system stuff.
PowerShell should raise the bar for lowest common denominator of scripting on Windows systems. I've dabbled a bit it, but I was disappointed it was so tightly coupled (possibly by necessity?) with the .NET runtime version. This makes it much more difficult to update on old systems. I had to write PowerShell in the oldest compatible version. It's almost like dealing with JavaScript implementations of all versions if I…
It does, called OneGet and recently rewritten.
You can also use chocolatey.
For windows update: https://www.powershellgallery.com/packages/PSWindowsUpdate/2...
Re: Linux Bash vs. Windows PowerShell
#44If you need crossplatform scripting and will install a runtime, why go powershell or bash ? Something like ruby or python seems more adpated.
Its designed for shell usage, python, ruby and friends don't feel "native" in that manner and are simply akward for many cases by missing most improtant thing - pipeline. People use them because bash suck and because they want to be full stack. Besides, Powershell comes with OS.
Re: Linux Bash vs. Windows PowerShell
#45Re: Linux Bash vs. Windows PowerShell
#46The second biggest issue I've seen is generic lack of robustness and maturity. Default cmdlets do the common case nicely, but once you have something unusual in the mix things go wrong fast... By unusual, I mean things like filesystem junctions, volumes mounted into directories.
If you want colors, Write-Host is nice. Except that it goes only to console AND to (undocumented?) file id 6! (same way like stdout goes to 1, stderr to 2, etc.).
PowerShell seems to behave slightly differently in each Windows version. A script that's written for Win10 1803 might just break under 1809.
I don't have much issues with Bash etc., even sh. It performs well and is very robust. I do hate its many footguns, like how easy it is to get escaping wrong.
Re: Linux Bash vs. Windows PowerShell
#47Article might be more successful if it demonstrated some of the advantages of PowerShell, such as returning the output as objects instead of lines, and what you can do with them as a result. I'll admit to being in the "Bash is what I know, I'll just install WSL/Cygwin/PuTTY on my Windows workstation and be done with it" crowd. PowerShell is on my bucket list of things I need to learn at some point, or at the very lea…
I made a Bash script for HN, and while I’m the furthest thing from an expert in Bash (I’m a newb), I was impressed by a contribution made with a port of the script to Powershell[1]. You can see the same script compared in Bash, Powershell and Python! Prior to this I had never really explored PS, but it is definitely cool Shameless Plug: [1] https://github.com/realrasengan/autobahn
I really dislike those comparisons where one side wins not because the language is better, but because it does much less.
Re: Linux Bash vs. Windows PowerShell
#48I think PowerShell doesn’t really compete with Bash, it competes with Python, Perl or the like. And I haven’t found it to be superior in that aspect other than at integration with Windows system stuff.
PowerShell should raise the bar for lowest common denominator of scripting on Windows systems. I've dabbled a bit it, but I was disappointed it was so tightly coupled (possibly by necessity?) with the .NET runtime version. This makes it much more difficult to update on old systems. I had to write PowerShell in the oldest compatible version. It's almost like dealing with JavaScript implementations of all versions if I…
Re: Linux Bash vs. Windows PowerShell
#49Re: Linux Bash vs. Windows PowerShell
#50Article might be more successful if it demonstrated some of the advantages of PowerShell, such as returning the output as objects instead of lines, and what you can do with them as a result. I'll admit to being in the "Bash is what I know, I'll just install WSL/Cygwin/PuTTY on my Windows workstation and be done with it" crowd. PowerShell is on my bucket list of things I need to learn at some point, or at the very lea…
I made a Bash script for HN, and while I’m the furthest thing from an expert in Bash (I’m a newb), I was impressed by a contribution made with a port of the script to Powershell[1]. You can see the same script compared in Bash, Powershell and Python! Prior to this I had never really explored PS, but it is definitely cool Shameless Plug: [1] https://github.com/realrasengan/autobahn
You'll notice that the PowerShell and Python versions are very similar.