Live data from Hacker News

Linux Bash vs. Windows PowerShell

vedipen.com

11–20 of 93 posts

Re: Linux Bash vs. Windows PowerShell

#11

This is a pretty poor comparison of the two, especially once it gets into the syntax, of which most of the Bash examples are broken in some way. There’s also a lot of just straight errors, such as mentioning “true” and “false” “values” in Bash, which don’t exist—the userland toolset includes “true” and “false” programs that can be used to inject desired exit code status into some logic flow, but there is no real conc…

To be pedantic: true and false are shell builtins in Bash and most other modern *nix shells. They are commands in the POSIX spec, though.

Re: Linux Bash vs. Windows PowerShell

#12

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.

By 'goes away' do you mean you don't need it or there's nothing equivalent?

You don't need it because the output of commands is a stream of objects rather than a stream of text.

Re: Linux Bash vs. Windows PowerShell

#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.

Re: Linux Bash vs. Windows PowerShell

#16

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 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

Post reply on HN