5 ms·
In defense of the Microsoft-haters, powershell is a fantastic idea with terrible ergonomics. When they first released it I was very excited but, well, it’s just
by skrebbel 3y ago
In defense of the Microsoft-haters, powershell is a fantastic idea with terrible ergonomics. When they first released it I was very excited but, well, it’s just awful to use.
Terrible Get-Finger-Twister -Recurse -Awfully commands, quirky aliases (you can type “curl” but it takes none of curl’s parameters because it’s an alias for Get-WebRequest-Annoyingly or whatever they called it), simple scripting things such as “include file relative to current script” (and not relative to current working directory), etc etc: anything that should’ve been simple and easy was neither.
I’ve stopped paying attention, so maybe they fixed this since then but it really wasn't a very well done system during its first decade or so.
- anticrymactic 3y agoWhile I tend to agree, a lot of commands also have pretty good aliases. For example `iwr` for Invoke-Web-Request. Also the full names are only expected to be used in scripts to maintain readability. No one types that in the console. Also ALL Parameters can be abbreviated if they are unique. If no other Parameter starts with R then -R is enough for -Recurse. (there are some quirks with this, but generally pretty intuitive) And using select or for-each on actual types is magical, instead of grepping/shedding/parsing a maybe standardized string, with completely unsensical names (like grep or sed) If you give bash and pwsh the same time and love, they will become both pretty ergonomic
- Maken 3y ago>Also ALL Parameters can be abbreviated if they are unique. If no other Parameter starts with R then -R is enough for -Recurse. (there are some quirks with this, but generally pretty intuitive) So, adding a new parameter starting with R to any command is a breaking change that will crash every script using it? Sounds like a terrible idea.
- Pet_Ant 3y ago> So, adding a new parameter starting with R to any command is a breaking change that will crash every script using it? In a script, write it out in full. When manually typing it’s okay to take shortcuts. There is always a tension between ergonomics and safety.
- hnlmorg 3y agoThat's really no different to the advice given for GNU coreutils: man grep | grep -- --recursive -r, --recursive
- tremon 3y agoAlso ALL Parameters can be abbreviated if they are unique They can also be abbreviated if they aren't unique, Powershell will just choose one for you. As an example: > Get-Content $file -r Will give you the error "Missing an argument for parameter 'ReadCount'", even though -Raw doesn't take a parameter.
- pjmlp 3y agoAlias, code completion and nice IDE tooling is the trick, not being stuck in UNIX like CLI mentality.
- 9dev 3y agoThat is the key. I will never understand why we’re stuck in a world of TeleType emulators, while having all the technology available to make Terminals with proper autocomplete, suggestions and inline widgets possible. And we’re probably not getting there if people insist on cryptic shortcuts instead of semantic naming, just because they’re inclined to type everything out manually. It’s like those developers writing their code in Notepad++ and pretend that’s the way.
- jampekka 3y agoNeeding an IDE for a shell!? "Tooling" is a design smell. It's building hacks on hacks to make bad design and lack of understanding somewhat manageable. For better systems all you need is a shell and a text editor. That said, we do need a better shell. But definitely one with UNIX and CLI mentality.
- 9dev 3y agoEmulating a printer connected to a typewriter is a design smell.
- jampekka 3y agoI agree. It maybe wasn't design smell when it was designed but 50 years later it definitely is a design/culture smell. Doesn't make "tooling" any less smelly though.
- 9dev 3y agoMaybe it is time to rethink what a terminal is, and get rid of the restriction to be text-only? There is really no reason for that, other than Typewriter heritage.
- hug 3y agoThe verbosity is a positive, so long as you understand the constraints in which it works. Cmdlets are specifically Verb-Noun, where the list of verbs is restricted to an approved list (Get, Set, Add, Remove…) and the noun naturally follows what you might expect. Want to get an organisational unit from Active Directory? Turns out the command is Get-AdOrganizationalUnit. Discoverability is built in. All of the switches are the same. Is it -R or -r for recurse on the Unix command to list OUs from LDAP? What is the command name, anyway? I dunno, but I know the flag I need is -Recurse on Powershell. Want to dump your DNS zones? Get-DnsServerZone is too verbose, obviously, so “cd /var/named/data && grep '\\(. *A *[0-9][0-9]*\\)\\|\\(..*CNAME..*\\)' db.*” is a much better option (‘scuse the escaping on that regex). Glad we could avoid the long command names. Born of experience, maybe. Don’t know what the command might be? Get-Command dnszone* saves the day. I suppose I could ask GPT-4 for the regex for the bind dbs, otherwise. These are all things I can teach juniors in about fifteen minutes flat. You don’t need to learn three different Turing complete languages, all of which overload the same set of flags with different operations, just to run an operation against a bunch of files. Familiar, shorthand, and obtuse is not better just because it’s familiar.
- larodi 3y agoVerbosity, for everyone who has actually written any bash/posh, any code tbh, verbosity is something to cherish. Because, u know, someone is going to eventually read it, and at best they will not be cursing the previous author. So this verbosity in posh is very well calculated, and again - sadly misunderstood by bash/perl hackers who very often care only about themselves and not their fellows.
- wiredfool 3y agoPowershell (at least mac/brew) has opinionated colors, and they don't mesh well with white window backgrounds. Even if you set the colors, there's error/confirm messages that are Bold or ordinary yellow on white.
- croon 3y agoThey are fixing stuff, but last time I used it (7.3) it looked like this: rm -rf in powershell: Remove-Item --Recurse But it gets better! (worse): https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/remove-item?view=powershell-7.3#-recurse https://learn.microsoft.com/en-us/powershell/module/microsof... >> Indicates that this cmdlet deletes the items in the specified locations and in all child items of the locations. >> The Recurse parameter might not delete all subfolders or all child items. This is a known issue.
- JeremyNT 3y agoYeah, it's in this weird space where the underlying technical direction feels correct but it's just too cumbersome in actual practice. The awful text manipulation in posix shells feels wrong on a lot of levels, but when you're just trying to accomplish something quickly the "just manipulate strings, always" api is faster to actually work with interactively. Powershell ends up in this weird space where it's clearly better for writing actual code, but the act of using it to do small interactive things is needlessly difficult. This is why posix shells stick around I guess - they suck as programming "languages" but they're good enough to do the job, yet they're just really fast to use interactively.
- hnlmorg 3y agoThis is why I created my own shell. I wanted something better than Bash but less cumbersome than Powershell (plus Powershell wasn't even available for Linux back when I started). There is a massive gulf between Bash and Powershell -- they're opposite ends of the spectrum -- and it's entirely possible to have something that cherry picks the convenience of Bash with the power of Powershell. Albeit compromises would still have to be made. There's quite a few alt shells these days now though. So other developers have clearly had the same thought as myself.