Live data from Hacker News

Linux Bash vs. Windows PowerShell

vedipen.com

21–30 of 93 posts

Re: Linux Bash vs. Windows PowerShell

#23
post #9

I 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 IE. Other scripting langues like Python provides user-space virtual environments with forward/backward compatibility. Does PowerShell have a universally available package manager (ie. Windows Update)? I don't spend much time in the Windows world. But, the friction of using PowerShell was higher than my tolerance.

Re: Linux Bash vs. Windows PowerShell

#24
post #21

If you need crossplatform scripting and will install a runtime, why go powershell or bash ? Something like ruby or python seems more adpated.

Powershell is more for administrative automation

Same, unless you are on windows only, ps has no benefit.

The selling point of ps is the piping of objects. Mac and linux api don't output those.

Re: Linux Bash vs. Windows PowerShell

#25
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 equivalent of `set -e`, or do `cmd && other_cmd`

2 - return values are very nuanced. If you don't understand how function statement contribute to the result, you will spend a lot of time debugging odd issues

Re: Linux Bash vs. Windows PowerShell

#26

Article 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 absolutely abuse Bash for more usecases than I should on my mac, but you owe it to yourself to try out Powershell Core on PC. It is very, very productive. If it weren't for a couple nuances, I would consider switching to it on my Mac as well.

Re: Linux Bash vs. Windows PowerShell

#27

Article 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 absolutely abuse Bash for more usecases than I should on my mac, but you owe it to yourself to try out Powershell Core on PC. It is very, very productive. If it weren't for a couple nuances, I would consider switching to it on my Mac as well.

PowerShell takes some time to grok, but once you get it it has very deep integration with Windows systems, and can become a joy to work with.

That being said, I still feel violated every time `ls` returns `bad command or filename`

Re: Linux Bash vs. Windows PowerShell

#28
post #13

The real difference is: in any reasonable bash script there will be a significant amount of awk, cut, tr and other commands to munge the output of one command into the input expected by the next. In PowerShell that totally goes away.

In the past 10 years I've noticed a lot of the manipulations I used to do in "awk, cut, tr" etc are baked into bash.

I would love to see examples please!

Re: Linux Bash vs. Windows PowerShell

#29

The real difference is: in any reasonable bash script there will be a significant amount of awk, cut, tr and other commands to munge the output of one command into the input expected by the next. In PowerShell that totally goes away.

Well, the real power of PowerShell comes from .NET - there are very few built-ins.

Re: Linux Bash vs. Windows PowerShell

#30

Earlier quoted context omitted.

I absolutely abuse Bash for more usecases than I should on my mac, but you owe it to yourself to try out Powershell Core on PC. It is very, very productive. If it weren't for a couple nuances, I would consider switching to it on my Mac as well.

PowerShell takes some time to grok, but once you get it it has very deep integration with Windows systems, and can become a joy to work with. That being said, I still feel violated every time `ls` returns `bad command or filename`

Are there different versions of PowerShell? 'ls' has always worked for me. 'ls -al' does not however, and that does feel a bit violating.
Post reply on HN