Live data from Hacker News

PowerShell is open sourced and is available on Linux

azure.microsoft.com

161–170 of 790 posts

Re: PowerShell is open sourced and is available on Linux

#161

PowerShell is my guilty pleasure of the computing world. Once you've piped strongly-typed objects around between your shell commands, text scraping seems barbaric by comparison. The problem, of course, is that you can't use all that power for much, since the pool of PS-compatible tools and utilities is much shallower than it is for Unix shells. I'm really hoping this will help spur a new wave of PowerShell-compatible…

I love the strongly-typed cookies but I absolutely hate the powershell syntax. It's like C# and Bash got together and had a really ugly baby.

Yeah, I wanted to switch to PowerShell but then I had to call an exe with variable arguments from the PowerShell script. That was a quick way back to cmd.

Re: PowerShell is open sourced and is available on Linux

#162

Earlier quoted context omitted.

Imagine for a second that the DB can't do it and you need to filter the STDOUT output.

Okay, I've imagined it. It does seem terrible. Fortunately, that's not a world any of us live in.

OK, but now imagine it's not a database, because there are programs that do act this way.

Re: PowerShell is open sourced and is available on Linux

#163

Earlier quoted context omitted.

The implicit return semantics are insane, since you can implicitly early-exit when you do things like call ArrayList.Add (which returns a bool to indicate whether the thing was added).

insane in a good way right? You aren't "returning" you are emitting to the pipeline

Not if you're in a script and declaring a function. So, no, it's a source of confusing bugs. Implicit return works better in, like, Ruby, where it has to be at the end and can't just randomly exit in the middle of a function declaration.

Re: PowerShell is open sourced and is available on Linux

#165

Earlier quoted context omitted.

This is why I find PowerShell to be an answer to a question nobody asked. If bash/zsh isn't cutting it for you, drop into something like Python, Ruby or Perl to do the heavy lifting. PowerShell will never accumulate a library as comprehensive as what any of those three have, each has had decades to accumulate packages of all kinds, and more are still being added. It's odd, but not surprising given their history of "N…

Powershell can use any .NET library... "Nobody" meaning you. Which is perfectly fine. But there are quite a few users of Powershell out there.

Now that it exists there are users, but when people were hoping for a modern or more portable replacement for DOS batch files I'm not sure this is what they had in mind.

Re: PowerShell is open sourced and is available on Linux

#166

Earlier quoted context omitted.

insane in a good way right? You aren't "returning" you are emitting to the pipeline

Not if you're in a script and declaring a function. So, no, it's a source of confusing bugs. Implicit return works better in, like, Ruby, where it has to be at the end and can't just randomly exit in the middle of a function declaration.

ArrayList.Add ... whatever ... | Out-Null

Its not implicitly returning. The return value wasn't assigned so it is emitted to the pipeline.

Re: PowerShell is open sourced and is available on Linux

#167

And now PowerShell on Bash on Ubuntu on Windows is a thing. (Spoiler alert, it doesn't work very well right now. The cursor keeps jumping to the top of the console and overwriting existing text.)

No, PowerShell on Bash on Ubuntu on a Windows VM on a Linux host is a thing :)

Re: PowerShell is open sourced and is available on Linux

#168

Can I write tools that use PowerShell and .NET objects in non-.NET languages, like Python or Perl (using the C implementations, not a .net python)? Like, is there an API that I can implement to interact to implement PowerShell-like "native" tools?

It's not the most efficient way to do it, but if you just want to get it done, Powershell has had e.g. ConvertTo-Json since version 3, I think? You can serialize pretty much anything at that point, and just hand that off to your target language.

If you're talking an FFI though, not so much, I think.

Re: PowerShell is open sourced and is available on Linux

#169

Earlier quoted context omitted.

Imagine for a second that the DB can't do it and you need to filter the STDOUT output.

Okay, I've imagined it. It does seem terrible. Fortunately, that's not a world any of us live in.

Er, it's a world all of us live in. Say, for example, ‘ps’ or ‘ls -1l’.

Then you end up using awk, which is rather like a half-assed version of powershell to work around shortcomings with the unix everything-is-a-string design.

Re: PowerShell is open sourced and is available on Linux

#170
post #140
post #116

Earlier quoted context omitted.

> Quick, easy. In a *nix shell that would be very tricky. You'd probably need to make an explicit SQL query since you wouldn't have the database integration.

Well, yeah, but I mean the concept (grepping in tabular data). If, hypothetically, bash had database integration, ls Columns would probably return something like foo varchar 30 NOT NULL bar decimal 8 baz int 4 Which would be a royal PITA to search for anything in—if I were to search for ‘int’ I'd get all int columns and any columns with int in the name…. I could've used an example involving process lists, but I didn'…

But thats why there are tools like awk.
Post reply on HN