Comment by blacktriangle

4 years ago

Credit where credit is due, we all WISH *nix had something like PowerShell. Passing strings from program to program is a pain, passing around .NET objects instead is a great step forward, as can be seen by the several attempts at similar shells passing around JSON objects.

PowerShell has been available on Linux via .NET Core since 2016 and version 6.0. Even my Windows box with PowerShell 5.1 likes to remind me of this fact every time I start it:

    Windows PowerShell
    Copyright (C) Microsoft Corporation. All rights reserved.
    
    Try the new cross-platform PowerShell https://aka.ms/pscore6

  • On that note, i'm saddened Windows 11 doesn't ship with Powershell 7. Are there that many breaking changes in the switch from 5 -> 6 or 5 -> 7?

  • yep, always good to get ads on your shell when you start it.

    it's like those awesome ubuntu login motd's, I look forward to them every time I log in, just in case the ad changes.

    er ...

There have been REPLs like PowerShell for ages, it's nothing really new. The only nuance in this is that it is new in the Windows ecosystem to have something like that supported by Microsoft. Ironically, it hasn't managed to displace the command prompt or batch files, so instead of having to deal with one thing, you now have to deal with two things.

As for the passing of strings: it might seem like a pain, but as soon as you start working with non-program I/O it's not like you'll have much of a choice. Keep in mind that it is the lowest form of communication and you can build on top of that. Same with I/O in general: nothing prevents you from using shared memory or a device instead.

  • > Ironically, it hasn't managed to displace the command prompt or batch files

    It don't think they expect that people would rewrite their old scripts. That is actually silly to consider. Even with console vs terminal, they are concerned of backward compatibility and leaving it as is:

    > Windows Console will continue to ship within Windows for decades to come in order to ensure backward compatibility with the many millions of existing/legacy command-line scripts, apps, and tools

    https://devblogs.microsoft.com/commandline/windows-terminal-...

    • They could just have an alternative interpreter mode to support batch files, or even have a cmdlet that does just that. If people like to point and click, associate that with a cmdlet (they can do that, right?) and there you go.

> Passing strings from program to program is a pain

The internet has been pretty successful and many popular protocols (http, smtp, etc) are exactly "passing strings from program to program"

  • And behind the scenes of internet-based services there's a whole ecosystem of "how can we do shit more robustly than just passing strings around" (or even for "better than XML or JSON").

  • Which is why all browsers render the same thing exactly the same way and there's no need at all to test more than one. Yep.

    • The presentation layer has nothing to do with he protocol layer...

      If you pump some serialised binary into a browser it will still render wrong.

> Credit where credit is due, we all WISH nix had something like PowerShell.

Who is "we". I've worked exclusively on a windows stack so used powershell on the job. But at home, I use bash. I don't want something like powershell in nix and don't use powershell on nix even though it's been available on nix for many years now.

> Passing strings from program to program is a pain

You can argue it's the basis of computer science and also pretty efficient.

> passing around .NET objects instead is a great step forward, as can be seen by the several attempts at similar shells passing around JSON objects.

Passing around objects can be slow, inefficient, wasteful, etc though it can be convenient.

If you are on a windows stack then go with powershell. If not, then go with bash. Nobody should be on a windows stack but sadly, much of the business world has been captured by microsoft.