Live data from Hacker News

PowerShell vs. Unix shells

stackoverflow.com

21–30 of 84 posts

Re: PowerShell vs. Unix shells

#21
post #7

Earlier quoted context omitted.

Yes, this is the preferred approach since Windows 2008 Server Core. Please note that Powershell is only installed by default in Windows 2008 R2 Server Core. You can then use Powershell remoting capabilites, or log into the server with SSH, like on UNIX systems.

Remoting is a bit hobbled I find. For example I'd love to be able to run vim in a powershell remoting session, but it doesn't seem to work.

That's largely because that's not really how Microsoft envisions you using PowerShell. The Windows way is to run the tool locally, edit the resource remotely (kind of like Emacs' TRAMP mode v. Vim users always sshing into the box). In this way, I kind of view PowerShell's direct remoting (i.e., Enter-PSSession) as a complete misfeature.

Re: PowerShell vs. Unix shells

#22
post #8

The main difference between the two, in my humble opinion, is that PowerShell is a nice (and powerful) addition to a Windows system, whereas the Shell is a fundamental component of Unix. Of 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…

> 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.

Since very few shell scripts run continuously for long periods of time, it's hard to justify prioritizing runtime efficiency over development time.

I remember ActiveState's Perl and the standard Windows version of Python have some API hooks that can be useful for manipulating Windows-only things. Can help leverage Cygwin tools on Windows.

Having said that, I always used Cygwin when I had to use Windows. It felt, of course, detached from the rest of the system, but it was a small island of sanity in a sea of APIs, registries and metabases... PowerShell is, indeed, a perfect match for the environment it evolved on.

As for the "can you do this" thing, I run bash on Android. Can PowerShell run on Windows Phones ;-)

Re: PowerShell vs. Unix shells

#23
post #2

When writing shell script, try to develop an awareness of how much you use sed, awk, tr, `` and so on to munge the output from one command into the format or value you want for the next. If it's a lot then something like PowerShell (or equiv on Unix) may be what you're after.

I used to do that a lot, but now, I very much try to avoid those for modifying command output - at least for scripts: it can be quite fragile. Usually utilities have options to output exactly what you need instead, or you can get the information another way (another utility, something in /proc, etc).

Re: PowerShell vs. Unix shells

#24
"closed as not constructive by Bobby, Kev♦ 20 mins ago"

This despite 111 upvotes on the question, 249 upvotes on the accepted answer, and 43 upvotes on the HN link (0 mins ago).

----

Dear Stack Overflow Moderators,

Seriously, what is it that you find to be so objectionable about interesting topics?

Love, bunderbunder

Re: PowerShell vs. Unix shells

#25

"closed as not constructive by Bobby, Kev♦ 20 mins ago" This despite 111 upvotes on the question, 249 upvotes on the accepted answer, and 43 upvotes on the HN link (0 mins ago). ---- Dear Stack Overflow Moderators, Seriously, what is it that you find to be so objectionable about interesting topics? Love, bunderbunder

There is no plausible objective answer to this question, thus its not for StackOverflow.

If you want to just talk about interesting topics, use a forum (so says the SO masters).

Re: PowerShell vs. Unix shells

#26
post #8

The main difference between the two, in my humble opinion, is that PowerShell is a nice (and powerful) addition to a Windows system, whereas the Shell is a fundamental component of Unix. Of 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…

> However, PowerShell is still treated as a second class citizen in the Windows eco-system, and that is, imho, its biggest weakness. I don't know about that. Microsoft operates NuGet (the .NET equivalent of NPM or Gems) and the way of downloading packages is through powershell (albeit a specially docked version inside Visual Studio). I agree that it's treated as second class in that most utilities are not designed wi…

[deleted]

Re: PowerShell vs. Unix shells

#27
post #8

The main difference between the two, in my humble opinion, is that PowerShell is a nice (and powerful) addition to a Windows system, whereas the Shell is a fundamental component of Unix. Of 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…

> However, PowerShell is still treated as a second class citizen in the Windows eco-system, and that is, imho, its biggest weakness. I don't know about that. Microsoft operates NuGet (the .NET equivalent of NPM or Gems) and the way of downloading packages is through powershell (albeit a specially docked version inside Visual Studio). I agree that it's treated as second class in that most utilities are not designed wi…

I have never touched power shell during my use of nuget fwiw. I'm not even sure how to if I wanted to. As far as I can tell it's just a graphical user interface. There might be some command line options somewhere but it does not seem like a first class citizen.

Re: PowerShell vs. Unix shells

#28

"closed as not constructive by Bobby, Kev♦ 20 mins ago" This despite 111 upvotes on the question, 249 upvotes on the accepted answer, and 43 upvotes on the HN link (0 mins ago). ---- Dear Stack Overflow Moderators, Seriously, what is it that you find to be so objectionable about interesting topics? Love, bunderbunder

There is no plausible objective answer to this question, thus its not for StackOverflow. If you want to just talk about interesting topics, use a forum (so says the SO masters).

"There is no plausible objective answer to this question, thus its not for StackOverflow."

The first half of that sentence is absolutely true. But judging by the enormous number of upvotes, StackOverflow itself (i.e., the people who make it up) disagrees about that second bit.

I fall on the side of Stack Overflow at large. Programming is, among other things, an art. Like in any art, there are sometimes situations where there is no objective answer, and the artisan needs to make a judgment call. And in those cases, a wise artisan may still wish to consider the opinions and experiences of other skilled artisans before deciding on an approach.

Stack Overflow has an excellent format for facilitating this, since it allows some people to share their opinion or experience, and for others to indicate whether they have a similar opinion or experience by simply upvoting that answer. The only thing in Stack Overflow that doesn't actually fit this use case is the green checkbox, but that can be ignored easily enough.

A forum, on the other hand, is a terrible fit for that use case. Forums are for having a conversation, not for getting a quick pulse of what other people are thinking. They leave no way to contribute other than adding an additional post, and they leave no way to get a quick idea of what everyone else is thinking other than reading every single item in the resulting mountain of posts and manually tabulating it all.

It's just possible that the SO masters have fallen out of touch with the SO community. To the extent that they have done so, they are a detriment to that community.

Re: PowerShell vs. Unix shells

#29
post #26

Earlier quoted context omitted.

> However, PowerShell is still treated as a second class citizen in the Windows eco-system, and that is, imho, its biggest weakness. I don't know about that. Microsoft operates NuGet (the .NET equivalent of NPM or Gems) and the way of downloading packages is through powershell (albeit a specially docked version inside Visual Studio). I agree that it's treated as second class in that most utilities are not designed wi…

[deleted]

If you go to any package on nuget.org, it's the way you're instructed to install. For example:

http://nuget.org/packages/Nancy

Re: PowerShell vs. Unix shells

#30
PowerShell was clearly tailored for system scripting, sysadmin, filesystem manipulations, etc... and it does a very good job at that.

Where I find it lacking is in the manipulation of large (10s of GBs) text files, which is what I do most of the time. If I try to cat a large file to wc -l I have to kill the shell because it starts eating all my memory. Even when the memory is not a problem, it is considerably slower than Cygwin or MinGW. I think that the lines are converted to System.String and cached in memory; if this is the case it might be very hard to solve this without an architectural change.

I haven't found any good equivalent of less or grep, things like head and tail are unnecessarily verbose, etc..

Also, the text input is not nearly as advanced as readline-based shells (no Ctrl-K, Ctrl-Y, Alt-Backspace, history search, decent completion...).

I sincerely hope that someone (MSFT or others) comes up with a better solution. Cygwin/MinGW are a reasonable trade-off but PowerShell proved that a much better integration with the system is possible.

Post reply on HN