4 ms·
PowerShell is more like interactive Python with very smart tab completion than "bash with objects." Basic conveniences like "grep" require some memorized script
by munchbunny 7y ago
PowerShell is more like interactive Python with very smart tab completion than "bash with objects." Basic conveniences like "grep" require some memorized scripting gymnastics because the commands got generalized a little too much.
For regular shell usage it's a bit painful because the abstractions are a bit too far removed from the file system you're operating on. But for scripting, such as managing and configuring systems, it's remarkably fluid.
The "nothing is as it appears" problem never bothered me much because it's still just data. You just specify the output when you're done crunching it. IMO being able to operate with typed data is really nice because you don't have to worry (nearly as much) about serialization between commands.
- hyperpallium 7y ago(Disclaimer: never used powershell, so unadulterated opinion here) Scripting is programming, so you want data structures. For interaction, you want human-readable syntax. e.g. programming languages mostly have a syntax: C, python, bash, fortran (exception: lisp), but they operate on data structures. We can see powershell, nushell and other structured shells (e.g. some use XML) as an attempt to "get out of the syntax business", which XML began and JSON finished (https://blog.mlab.com/2011/03/why-is-json-so-popular-developers-want-out-of-the-syntax-business/ https://blog.mlab.com/2011/03/why-is-json-so-popular-develop...). This has been taken further into human read/write domains... with mixed reception: ant, XSLT, json as a config format. After all, parsing and "the syntax business" has a practical purpose.
- felixfbecker 7y agoThis is not true. If you want, you can literally pipe PowerShell output into grep (or select-string, which does the same) and it will filter by the tabular representation of each row. That can work just fine in interactive use cases and while it is less accurate and performant, it is the same bash. The key to success in using PowerShell as an interactive shell is to memorize aliases and not caring about casing and spelling everything out. PowerShell is case-insensitive, has aliases (e.g. ? instead of where-object, or % foo to get the foo property of every object) and will accept abbreviated command and parameter names if the abbreviation is unambiguous. It is also useful to know about the different formatting cmdlets: mostly format-table (ft), format-list (fl), and that you can pick properties with -p (-Property). While PowerShell usually does the right thing, with these you can get the most appropriate formatting for any use case.