PowerShell vs. Unix shells
stackoverflow.com
PowerShell vs. Unix shells
1–10 of 84 posts
Re: PowerShell vs. Unix shells
#2Re: PowerShell vs. Unix shells
#3For example, could you put a Windows Server with PS behind SSH and login and config everything that way without having to touch the GUI?
Re: PowerShell vs. Unix shells
#4Re: PowerShell vs. Unix shells
#5* Powershell is more capable than bash, straight up.
* bash is easier to use; writing ad-hoc pipes etc. in PowerShell has never seemed pleasant to me, the commands are verbose and the contractions non-obvious; getting help is tedious, and options are often very long.
* Object orientation works well when you're dealing with meaningful objects. But often you just want to deal with a singular list of items, and it can make things more awkward. It's a bit like the OO - relational dichotomy.
* Interaction between PowerShell and Unix utilities is very clunky, because by default PowerShell will include column headers and formatting characters as part of the output. Something else that's unpleasant: PowerShell doesn't have a simple mode that can work well inside a terminal. I mean, just running PowerShell inside Cygwin mintty results in a copyright notice and an apparantly hung program. That's because it's using ReadConsole rather than ReadFile for I/O, but ReadConsole only works in Windows' horrible console windows. You can work around it with 'powershell -', but then you don't get a prompt. Similarly, running a PowerShell script requires echoing a return character to the PowerShell process to get it to exit! Literally: "echo | powershell -file ". It's a bit ridiculous.
* Deeper Windowsy things like WMI or COM automation work infinitely better with PowerShell. In practice, the only time I use PowerShell is when I need access to something in this area; and then I'll take some arguments, do the PowerShell work, then output the results as text so I can do the main work in bash.
Powershell doesn't really feel like a shell to me. It's more like a SQL query command line and scripting language REPL hybrid. For example, something as basic as job control is almost non-existent. Forget about carefree application of '&' and 'wait'; that style of working, doesn't.
Re: PowerShell vs. Unix shells
#6Re: PowerShell vs. Unix shells
#7How much can you do with powershell regards system configuration? For example, could you put a Windows Server with PS behind SSH and login and config everything that way without having to touch the GUI?
You can then use Powershell remoting capabilites, or log into the server with SSH, like on UNIX systems.
Re: PowerShell vs. Unix shells
#8Of course, the two shells may be equivalent in terms of power or number of features, and any contest a la "Can your shell do this?" would be futile. To me, it's a matter of cultural differences. Think of it this way: a shell operates in two mode, script or interactive (the new fancy word now is REPL). How much time does your average PowerShell user spend in REPL mode?
In comparison, a Unix hacker spends all his time in the shell, even for doing the most trivial tasks. As you practice more and more, the shell becomes a favorite way to operate a computer. Even tasks that may seem easier on a point-and-click interface (like selecting a few files from one directory and copying them into a new one) come more natural to me on the command line than with a mouse. The day I discovered that you can run 'for' loops from your interactive shell as naturally as a script, I almost uninstalled X :)
My only point is that the shell fits in the overall philosophy. You probably heard of the famous McIlroy vs Knuth story (legend?), where a pipe of a few commands turned out to be more efficient than a Knuth data structure. That's beyond my point. What I want to show is more the ending paragraph of this story, what McIlroy had to say about it:
> Very few people can obtain the virtuoso services of Knuth (or afford the equivalent person-weeks of lesser personnel) to attack nonce problems such as Bentley’s from the ground up. But old UNIX hands know instinctively how to solve this one in a jiffy.
That last sentence. Unix hands know how to solve these problems because of all the time spent on their command line.
Overall I'm glad that Microsoft is developing PowerShell, and I absolutely agree that it is far more adapted to their Windows platform than the old "all-is-text" mentality of bash and the POSIX tools. However, PowerShell is still treated as a second class citizen in the Windows eco-system, and that is, imho, its biggest weakness.
Re: PowerShell vs. Unix shells
#9I guess server people would not encounter this problem.