Not sure that's a fair comparison though. `du` isn't built in to bash, afaik; you could just as easily type `du -sh <folder>` in PowerShell.
If you /did/ need to do it without `du` then it would be something like:
`dir <folder> -Recurse | measure -Property Length -Sum`
which is easier to remember than whatever the equivalent bash would be, imo.
>Not sure that's a fair comparison though
Maybe not in a technical sense, but I've never encountered Bash without GNU coreutils (or busybox). I'm just comparing how I would solve a problem in a typical *nix environment, compared to a Windows environment.
This is my experience too, anything non-trivial quickly becomes an absolute mess, even the trivial things often have bad defaults. A few years ago I looked into using it as a build system for .net projects but ended up tearing my hair out on even the simplest things like removing directories or recursively copying html files: http://flukus.github.io/powershell-is-a-joke.html
Re:PowerShell 7.0
by CuriousSkeptic on Wednesday March 04, 2020 @06:43PM
(#22489394)
If you do find yourself in this spot. Have a look at Invoke-Build. It adds some sanity to such scripts, to the point of almost being enjoyable.
Edit: (I only use it to orchestrate and combine other build systems though)
Bash has that as well.
This thread is full of praise for PowerShell, but every time I've tried to use it, I've become annoyed with it. For example, to get the size of a folder in Bash, I'd type `du -sh <folder>`. In PowerShell it's some absurd code spaghetti that someone put in a Github repo [1]. No matter what I try to do in PS, I find the syntax ridiculously verbose. Maybe I just don't get it, whatever it is. \shrug\
[1] https://github.com/gngrninja/PSFolderSize