nunez a day ago

Former Windows admin and ex-HEAVY Powershell user here!

I did too until I spent a few years using Bash and other programming languages. It's a super quirky language, and manipulating strings vs objects is a minor inconvenience, but I find Bash to be much more versatile in what it can do while being less verbose.

I also like that it depends on other utilities for core functionality, as I'm a big believer of "do one thing, and do it well".

Example: you can use Extract-Archive in Powershell (I think v7) to decompress ZIPs or tarballs (unsure if it works with gzipped archives), but what you can do with it is limited to the capabilities of .NET library and built-in shim from which that cmdlet originates. tar and zip/unzip, on the other hand, are classic coreutils that ONLY do this and, as a result, can handle many more edge cases, such as dealing with split archives.

Anyway, I usually turn to a programming language if I find myself needing objects, as it's better suited for the task, and PoSh gets super complicated once you start invoking DLLs (IMO, though this opinion is 10 years out of date from back when PoSh 5 was new and Snover was still involved)

Doubly anyway, PoSh is on Linux, as is .NET. It's usefulness there, however, is much more limited. For one, it isn't built-in like shells are. Additionally, because most *nix sysadmins will already know shell scripting, the motivation and need to learn it won't be as strong. In fact, the only time I've needed this was for some edge-case thing pertaining to Azure.

rlupi 2 days ago
  • jamesholden 2 days ago

    He did note that in the article. It's under 1). at the bottom as well.

    > "I realize PowerShell is cross-platform (I wrote this on macOS) but good luck evangelizing it to teams used to Linux."

    Well, this is about his _own_ use no? So why not just use powershell in Linux? If it's good, tell us why. I actually am in the same boat. I spent a lot of time learning it, and I do know bash, but not as well. If there is a happy medium here, it's nice to hear your experience about that. Not just say 'well good luck convincing others'.

account-5 2 days ago

What about Nushell? It's still a separate install on all platforms, and not POSIX compliant (for reasons). But for me it's got all the benefits of powershell without the verboseness and imo a less obscure data structure.

https://www.nushell.sh/

7bit 2 days ago

PowerShell is just so good. The fact that it's a shell but I can use every output like a C# object is just terrific. No more awk or sed etc. lovely!

  • pseufaux a day ago

    This is about the only thing I like about PowerShell. In Unix-y shells I can use a combination of `jc` and `jq` to get a similar effect. Not quite as convenient as PowerShell though. That said, even after using it daily for years, I never was able to get used to all the weird inconsistencies and footguns.

greatgib 2 days ago

I think that it is just the case of a Windows power user that is so used too it's ecosystem that he did not yet aquire the ease of use of linux native things.

PowerShell give the impression of being simple for basic users but it's a cluster shell of complexity. With a mess of everything being subtly different and broken. Just look at the case of Microsoft that hijacked the curl command in PowerShell with different arguments.

It's even worse if you are an intense user of vscode because they will obviously go hand to hand.

The whole article has proof of my opinion.

For example: still have not bothered to add tab completion to my shell scripts because of the extra steps involved. I am lazy.

   PowerShell gives you this for free when you write a “cmdlet” 
He says that PowerShell gives the completion for free but for that he has to create a cmdlet and fill the prototype and typing info going with it. And that will just give you basic argument completion but not logical one like a lot of tools do.

So it is not at all "free", just it is used to do it with PowerShell so doesn't notice the cost anymore. Like people saying that they never encounter bugs and annoying issues with Windows when they have some every few hours but they are totally used to it anymore.

  • account-5 2 days ago

    I don't think it's fair to say Microsoft hijacked the curl command. It's just an alias for a powershell cmdlet. Powershell is definitely not perfect but theres less pitfalls than bash (string quoting, etc; there's loads: https://mywiki.wooledge.org/BashPitfalls). I think powershell was/is a step in the right direction, but in that respective I also think Nushell is a massive improvement on top too.

    All of this is opinion though, I just prefer the stuff you get out the box you don't with bash.

    • nunez a day ago

      I create courses that are taken on Linux and Windows.

      On one hand, I love that curl is aliased to iwr, since I can tell learners to run a curl command without arguments and trust that it will work cross platform

      On the other hand, iwr is a cmdlet that shortcuts the System.Net.WebRequest .NET method, which is very, very different from libcurl.

      For example, the cmdlet uses one of its properties to obtain bytes downloaded so that it can display a progress bar. Unfortunately, doing this seems to be blocking, as downloads complete SIGNIFICANTLY more quickly if you add -NoProgress to the command. This break cross platform compatibility, however, which adds complexity during course development (more tests, more copy, etc)

      • account-5 a day ago

        I've been using iwr for years and didn't know that the progress bar added latency! Much appreciated.

        My main point to the OP was more that it's just an alias, you can remove it and use real curl if you want.

        • nunez 19 hours ago

          No problem! I definitely recommend using the real thing where possible!

lawls 2 days ago

But can't you just use fish?

  • sargstuff 2 days ago

    Why not just install Powershell for linux?[1]

    [1] : https://learn.microsoft.com/en-us/powershell/scripting/insta...

    • tangotaylor 2 days ago

      I could but no one else on my team (which is used to Linux) would touch my scripts.

      It’s just too foreign for Linux devs whereas it ships with Windows.

      • sargstuff 2 days ago

        Proprietary 'shell' vs. linux DIY/customized setup.

        There are a multiple publically accessible/usable sources which can be found via search engine(s) to extend bash / unix shell functionality based on points discussed in topic link.

        few article link topic snippits:

        * approaches to autocompletion : [0][1]

        * 'man' command and/or cli option -h to cli command shows 'docstring' / options

        * jq resources for shell plugin[2]

        --------------

        [0] https://faun.pub/configure-bash-auto-completion-tab-completi...

        [1] https://tiswww.case.edu/php/chet/readline/rltop.html

        [2] https://github.com/fiatjaf/awesome-jq

        • nojito 2 days ago
          • jdmg94 2 days ago

            that is a thing that started under Nadella's leadership, during the 90s it was a different story.

            • feldrim 2 days ago

              Those two "PowerShell"s are not the same. For the sake of cross platform deployment, they moved away from the original a lot -though they managed to support many things in time. The old and original one was released in 2006,IIRC, so it didn't exist in 90s.

      • rastignack 2 days ago

        Nowadays a lot of people script in python

        • general1726 13 hours ago

          Yeah sure after they are done fighting with venv or why this scripts written in a different version of Python behaves differently on this computer...

          During scripting they can be constantly annoyed by Python's indentation errors. Really awesome stuff when your syntax is whitespace dependent.

  • tangotaylor 2 days ago

    I put a note at the end about that: the lack of a `set -e` / fail fast equivalent was a dealbreaker for me.