5 ms·
PowerShell as a _shell_ language though is really cool. Yes, scripting large scripts can be cumbersome, but actually having a PowerShell prompt beats having a c
by Kichererbsen 5y ago
PowerShell as a _shell_ language though is really cool. Yes, scripting large scripts can be cumbersome, but actually having a PowerShell prompt beats having a cmd.exe prompt any day hands down!
Some of the things are not... ideal. And there's a bunch of legacy stuff in modern powershell that we could do without, but a REPL scripting language with pipe semantics is really useful on a day-to-day basis.
I'm not sure C# would work as a shell language at all.
- katbyte 5y agoI could never get used to verbrosesess of powershell and even when I worked with windows would always install cygwin for bash.
- AnIdiotOnTheNet 5y agoWhy do people keep complaining about PowerShell verbosity? There are default aliases for common commands, tab completion of everything, and user-defined aliases. PowerShell is only idiomatically verbose so people can actually read it, unlike your average unix shell command.
- Someone1234 5y agoBecause they start at the conclusion and work backwards. "It isn't what I'm used to, therefore bad, now let me figure out why." After that the length of commands is an easy target, in particular if you don't know enough about it to criticize it for anything substantive.
- katbyte 5y agoIt's a shell, I don't want to write a novel to get something done. bash is a bunch of small composable binaries that chain together easily. powershell is, was? not. length of commands IS important imho for a shell as I want to be able to quickly type out what I need to do and then move on
- psd1 5y agoI can code-golf in powershell. You could too, if you tried. Powershell is based on small composable commands that are easy to chain together - as you would know if you've used it at all. Valid criticisms exist of powershell. It baffles me why Linux refuseniks trot out such easily-discounted objections. My belief is that it's a figleaf over a political position: "I will never use a Microsoft product". We're on HN; that's an acceptable position. Why bullshit?
- majkinetor 5y agoI blame everybody: https://news.ycombinator.com/item?id=29488422 https://news.ycombinator.com/item?id=29488422
- sofixa 5y agoBecause it's painful. The tab completion works in a weird way by filling the first available option when there are many, instead of proposing them all, meaning it's outright harmful in 90% of the cases, and is completely different than the established norms in *nix land. Aliases aren't recommended because they remove the main advantage of the verbosity, readability.
- AnIdiotOnTheNet 5y agoA) Tab completion behavior in PowerShell is configurable 2) You just keep hitting tab until you get the one you want. This is the tab completion behavior of the Windows command line since it added tab completion. C) Did I mention it's configurable? https://stackoverflow.com/questions/8264655/how-to-make-powershell-tab-completion-work-like-bash/37715242 https://stackoverflow.com/questions/8264655/how-to-make-powe...
- lukeschlather 5y agoPSReadline makes Powershell tab completion basically behave like zsh or bash. https://github.com/lukeschlather/dotfiles/blob/master/src/WindowsPowerShell/profile.ps1 https://github.com/lukeschlather/dotfiles/blob/master/src/Wi...
- vips7L 5y agoYou can set Tab Completion to Menu Complete and it will show you all the options.
- jen20 5y agoFor many years, the aliases were worse than the problem. Aliasing `curl` to `Invoke-WebRequest` without also aliasing the flags was a crime against usability. That said, tab completion works, and I used PowerShell on macOS for a long time with no complaints.
- AnIdiotOnTheNet 5y agoOh I totally agree about the unix-mimic alias names, they're terribly misleading. Having Invoke-WebRequest originally use the IE engine for parsing by default was also a terrible idea, but at least they reversed that one.
- katbyte 5y agobecause when I am in a shell I don't want to spend days typing out and tabbing forever trying to write some quick one liner command I'll never look at again. I just want a bunch of quick and easy to compose functions to just do what I want, and then move on. I don't need it to be readable, just quick and functional which bash is. for scripting I'd personally use neither.
- deleted 5y ago[deleted]
- AnIdiotOnTheNet 5y ago> because when I am in a shell I don't want to spend days typing out and tabbing forever trying to write some quick one liner command I'll never look at again. Even without the hyperbole you have a comically exaggerated idea of how long it takes to write quick one-liners in PowerShell. For me personally, it helps a lot that I don't have to look up cryptic three-letter command names, obtuse switches, or the precise sed incantation to glue things together.
- Someone1234 5y agoThey have a lot of shorthands for common commands, and the verboseness is on purpose, so you can guess commands and by correct 9/10. - They have a list of standard verbs: https://docs.microsoft.com/en-us/powershell/scripting/developer/cmdlet/approved-verbs-for-windows-powershell-commands?view=powershell-7.2 https://docs.microsoft.com/en-us/powershell/scripting/develo... - Every command is verb-noun. So get-[whatever], remove-[whatever], set-[whatever] etc. Therefore, you can guess get-process would be a command as is stop-process or start-process.
- kaba0 5y agoAlso, every parameter is fuzzy-matcheable.
- kaba0 5y agoI’m sorry, maybe it’s just my experience at work where I have to use it, but I really honestly hate these bash emulations on windows. Like, I honestly don’t get the point. It will die with the stupidest errors due to mismatches between the underlying abstractions, it is slow and not even its terminal emulation is on point.
- katbyte 5y agoI can only speak to cygwin, 10ish years ago, but it worked flawlessly for me at that point.
- dev_tty01 5y ago>PowerShell prompt beats having a cmd.exe prompt any day hands down! That's not a very high bar to exceed. A glass of water seems like champagne to someone in the desert.
- kaba0 5y agoOther than familiarity, it does beat bash as well, hands-down.
- netizen-936824 5y agoI will absolutely agree here. As a heavy Linux user, I always reach for PS over cmd when I need to work on a windows system The main reason for this though, is that I can use some familiar Linux commands and I don't need to google how to list files in the current dir (PS and bash both have ls, among others)