3 ms·
The problem of powershell is not merely thet it's new and different, and not merely that you have to learn a new and different way to get a given task done. Po
by Brian_K_White 2y ago
The problem of powershell is not merely thet it's new and different, and not merely that you have to learn a new and different way to get a given task done.
Powershell makes some things possible or easier that weren't possible or easy, but only at the expense of making other things either impossible or at least vastly less practical, and all in all it's a bad trade off and a wrong set of priorities for the job it claims to fill, or at least for the job bash currently fills. It's not that bash is a gold standard, just that it's not fundamentally wrong.
- xelamonster 2y agoIt's also just absurdly verbose for a language intended mainly for manual input. I get annoyed having to type out `sudo systemctl` multiple times in a row, in Powershell every single command is at minimum that long. Which makes it way more difficult to memorize the commands too.
- Vegenoid 2y agoIMO, getting comfortable with and tuning autocomplete makes this a non-issue, and the benefit of the verbose commands is that they are very discoverable.
- rustyminnow 2y agoAny tips or links for tuning? zsh has a powerful engine and lots of great work out there, but when I've tried cooking my own it's all just too dense to get "comfortable" for long.
- WorldMaker 2y agoFor VS Code there is a good first-party PowerShell extension which helps a lot at writing scripts in the verbose style. There's experimental new IntelliSense available in the VS Code terminal: https://code.visualstudio.com/docs/terminal/shell-integration#_experimental-intellisense-for-powershell https://code.visualstudio.com/docs/terminal/shell-integratio...
- WorldMaker 2y agoThere are ton of aliases. It's "impolite" [0] to use aliases in scripts and documentation so looking at PowerShell examples is way more verbose than actually using it day to day in a REPL. Sure I could write `Set-Location` a million times a day, but I just use `cd` in the old ways. Same with `Get-ChildItem`, I tend to just use `ls` myself because of ancient habits. (I find it interesting how many have been moving to `gci` instead as the more PowerShell-native `ls` alias. I've not been convinced to do that myself, but I think it has to do with `gci` is way more powerful than most shells' `ls` and is used to navigate everything from folder structures to object structures including that its not a bad `jq` if you convert JSON files to PowerShell objects.) [0] It's from a version of the Python ethos that code is read way more often than it is written, so when you are polishing PowerShell code to share with others you expand all the aliases so that it is easier to read.
- frenchyatwork 2y agoWhat about the part of the Python ethos where "There should be one-- and preferably only one --obvious way to do it"
- WorldMaker 2y agoA) PowerShell isn't Python, it doesn't have to (and doesn't) import the whole Python ethos, just the parts that make sense for a Shell and Shell language with different end goals. B) PowerShell doesn't care as much about the first part because shells have always had aliases and macros, but it does care about the second half "obvious way to do it". The other reason for starting with verbose names and aliasing them for day to day REPL use is to aid discovery. It's often very easy to discover which command or cmdlet does the thing you need simply because it is right there in the name. Sometimes you can just guess the name because there are only so many "allowed" verbs and you just need the noun you want to "verb". `Get-Help` can be quite powerful, `Get-Verb` can help explain some bits about what the verbosity is meant to mean. You can search for commands with `Get-Command`.
- nerdponx 2y agoPython itself doesn't follow that at all, ignore it.
- emmelaich 2y agoDo you know that there are short versions? e.g. gc for Get-Content
- abhinavk 2y ago> sudo systemctl Make an alias like sctl. Takes 5 seconds. Or an abbr if you are using fish. They are more like text-expanders than aliases.
- 7bit 2y agoReally? I only have to remember Item instead of touch, mkdir, RM, rmdir, cp, mv. All commands that have just different verbs before the Noun in Powershell. And that's for every single cmdlet out there. It sounds to me that you're unfairly putting your existing knowledge about Linux shells into your criticism of PowerShell. If you want to be fair that criticism should come from the POV of someone who does not now both and now wants to memorise it. And whether or not commands are short or long does not matter. People memorise lyrics, or names of hundreds of people. Length is not a factor, objectively. And alias do exist.
- TristanBall 2y agoCurious as to what's "vastly less practical" in powershell?
- hi-v-rocknroll 2y agoTrue. PS has platform-specific API hooks that are orthogonal to the capabilities of other shells, and more-less replaces JScript, VBScript, and .bat files. Putting that stuff aside, it is/was one of the first command shells/REPLs outside of SQL DBMS ones in a long time to support manipulation of structured information. For a smoother transition, shells like nu that can straddle structured and file-/line-/word-oriented will be more successful than leaping to too radical of upheaval.