Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

PowerShell takes the UNIX philosophy, cranks it up to 11, and makes commands trivially discoverable.


There are things that powershell does well, but I wouldn't say that it's really all that unixey. It relies far too heavily for the user to have an understanding of the windows object model, which frankly a lot of sysadmins don't have and refuse to learn. In unices the pipeline is just that, a way to send a stream of bytes from one place to another. In pwsh it's more complicated than that since it passes an object along with the preceding command's metadata.

In my personal experience, powershell is fantastic for writing scripts and tooling, but not really so great for actual use as a shell. What makes a good shell is speed and 'muscle memory', imo.


Thats nonsense really. What windows object model ???

Your 'simple' pipeline becomes hard core once you take into account all other things you require like grep, awk, sed, xargs, mount etc. Hack, even basic boolean stuff is from another dimension with executables like `[` or `true/false` (yeah, I know mostly builtin nowdays)


> your 'simple' pipeline becomes hard core once you take into account all other things you require like grep, awk, sed, xargs, mount etc.

That's the whole point of unix. Non-integrated tools that talk to each other using plain text.


It's exactly the same for PS.

Just as you have to look at a text output of a unix command to figure out how to parse it and extract the subset of information you need from it, so do you have to look at the help metadata of a PS command to figure out how to extract the subset of information you need from its output.

The advantage of having objects instead of text is that if you thought you could parse the filename of grep matches by substring each line of `grep -H`'s output with `:`, you failed to account for filenames with colons. With PS's sls, its help metadata tells you it outputs `Microsoft.PowerShell.Commands.MatchInfo` objects, and the documentation for that type tells you it has a `Filename` property of type string.

One PS command is not "integrated" with another PS command; they're all integrated to .Net and a bunch of built-in PS types.


Thanks for your answer, and I see where you are coming from. But your unix is not the same as my unix. For me, unix means programs that can be easily written using only the getchar and putchar functions. If you have "types" and whatnot, it's not unix.


It's not often you hear someone criticise a tool for not having enough unnecessary encoding and parsing steps involved.


Are you talking about people who promote JSON-RPC and whatnot? Sure, they are nuts, but what does it have to do with unix?


Funny enough given the linked post - Powershell owes it philosophy to VMS as well, e.g. the verb-noun command structure.

https://devblogs.microsoft.com/powershell/verb-noun-vs-noun-...

https://ilovepowershell.com/2013/08/05/microsoft-virtual-aca...


How to discover commands?


Powershell pretty much has universal tab-complete. Typing a command, '-', and repeatedly hitting tab will cycle through all available arguments for that command, and arguments will be quite consistent between commands. But you can also tab complete variable names and the commands themselves.

Discovering the cmdlets is not as trivial as it could be, because they are named verb-first instead of noun first. Get-<tab> is not as useful as NetAdapter-<tab> might be, but since things are named sensibly you can do a little guess work and use tab-completion to find what you're looking for in the vast majority of cases.


> Discovering the cmdlets is not as trivial as it could be, because they are named verb-first instead of noun first

Irrelevant. Use

    Get-Command *network    #network anywhere in noun
    gcm *-network*          #network as first word in noun
PowerShell has it all, its just that people don't bother to learn it.


Which good documentation do you recommend?


Poweshell in depth, or in month of launches.

But, experience is more important. Simply do everything in posh, even if there is a handy gui. After a few months you are closer to pro then with any books.


should't the first one be "network as last word"?


Indeed. My bad.


[flagged]


Yes it does. Learn it before commenting.

Furthermore, its definitely way more unixy then any *nix shells.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: