Hacker News new | ask | show | jobs
by MichaelGG 3715 days ago
Powershell's almost great. Things are way too verbose. No built-in stuff like curl or wget (yes, there's a simple webrequest thing and aliases, but they're clunky). In fact, it feels like everything in PS is clunky.

Just simple stuff like "time ./foo" becomes "Measure-Command {... }" and then it prints out 10 lines of the same measurement, in different units. And doesn't distinguish CPU time versus wall time.

All that adds up and makes PS crap for interactive work. As far as writing programs, PS is a much better programming language than bash.

And yes, I understand that using a bunch of 3 or 4-char names kills your global namespace. But judicious use really aids ergonomics.

5 comments

Yeah, for things like that, I have a wrapper function and/or aliases which get loaded with PowerShell. The over-verbosity I'd imagine really helps the "click next-get cheques" guys who are a little intimidated by the command-line. (I on the otherhand bleed Hayes 9600 baud and VT220 green cold cathode.). 'ps aux' wouldn't really cut it. Just like one customizes their bash, fish, zsh or whatever shell, you customize your PS shell with modules (the Powershell Community Extensions (PSCX)) and other such things (SQL Server integration with Powershell? Yes please!).

So you effectively can do t foo, which your alias to a wrapper script around Measure-Command and get the same effect. But, wait, you also want to log the outputs, just to keep track of the progress as you refine the memory allocation on my_malloc.cc. Pop into ISE[1] stock with Windows 8+ (or your favorite Powershell editor) add a few lines and now you can have a log that associates each revision with it's performance. Keep it open like you would your editor and your .bashrc or .zshrc or whatnot.

The great thing about that is I only have to write the verbose command once and it's entirely clear what that command does. I can share it with anyone and they can run it, assuming they have .NET 4 or higher. They know immediately what it does.

RE: Other software - All the unix utils (grep, awk, etc) are in a downloadable "Gow". Windows has a package manager "chocolatey" which is basically like the apt repos. All the software is vetted. Heavily. They run every binary through VirusTotal which is 57 engines from the enterprise Sophos type stuff to the less-good-ones.

I've run into one bug in 18 months (multiple python installs 2.7.1 / 3.4.x + the env var of PythonHome conflicting references. I'm sure there's a solution but I don't care enough about python to research it).

[1] https://i.imgur.com/dXmT2MX.png

Hayes 9600 baud? VT220? Geez, kids these days...setting your (directly attached) ADM-3s to 1200 bps in order to smooth over the task-switching jerkiness of your PDP-11 ;-)

Back to PowersShell. When I first looked at it, it seemed like just the right answer, but on closer inspection...not so much. Being able to customise: yes. Having to customise right out of the gate to get an even barely usable experience: not so much.

It is obvious that the task is difficult, but PowerShell shows many interesting direction and some ways to not solve it.

> No built-in stuff like curl or wget (yes, there's a simple webrequest thing and aliases, but they're clunky).

wget is a built-in alias in Powershell. 'Wget' alone gets you an object of course, with the status code, headets, etc. included. (wget http://google.com).Content gets you the content.

Seems about the same as basic uses of wget. Can you go into more detail?

The verbosity doesn't bother me too much personally: it saves me a lot of time remembering commands and there's tab completion, and of course there's aliases.

Powershell seemed like a great advance upon cmd, until I realized it was a great step backwards from Python. It's an objectful interpreted scripting language, but suffers from poor namespacing, verbosity, and some fairly insane defaults.

Meanwhile, IPython as a shell[1] has been around for years. I do mostly python scripting, and spend much of my day at an ipython shell. I don't personally use it as a general purpose shell, but it is perfectly acceptable for many problems that I use if for.

[1]http://ipython.readthedocs.org/en/stable/interactive/shell.h...

Your complaint about clunkiness isn't wrong. But consider the contrast of (1) stating a full phrase that preserves the symmetry between syntactical constructs with their semantic counterparts or (2) the acronymic representation thereof. Whilst (1) is always clunky, it tends to be easier to use for non-experts, whereas (2) is minimal but requires an expert-level familiarity. In essence, it is little different from the contrast between written English and written Chinese.
It sounds a lot like the VMS shell (outside the directory manipulation and file redirection which was horrid, it wasn't that bad of a shell and the help facility was first rate).