Live data from Hacker News

PowerShell is open sourced and is available on Linux

azure.microsoft.com

81–90 of 790 posts

Re: PowerShell is open sourced and is available on Linux

#81
post #39

Earlier quoted context omitted.

Objects are discoverable in powershell. Enter the object, and lists the object out as text.

Yes, this is so awesome. Can't remember the exact parameter/field? Just dump it to the console.

That what you would do with text? If you have no idea what its outputting, explore it by putting it to the console.

Re: PowerShell is open sourced and is available on Linux

#82
post #61

Is this actually useful? I always thought powershell was largely just for interacting with windows components, like installing an msi or talking to active directory. What would you actually practically use this for on a linux box?

Scripting. While I typically use Bash on Windows to use grep to interactively test my webserver, I'm much happier using Powershell ISE (which I don't know was ported [1]) to write standard tests with multiple parts, particularly ones that require e.g. checking cookies on the response. 1. Looks like they ported a service that does the same. https://github.com/powershell/powershelleditorservices

Can you be more specific?

Powershell instead of using grep? Or as a testing framework? Or an embedded interactive REPL?

I mean, just broadly, with basically zero knowledge of powershell, what I see is a custom scripting language with a set of common 'macro' commandlets that do little tasks.

...but, I don't see how that's useful?

How do you import a package to upload a file to S3?

I can't just install https://aws.amazon.com/powershell/ right? ...because that's not ported? So...? etc. etc. for other practical tasks.

Not trolling; just genuinely curious what actual tasks are actually supported that you could actually use this for, beyond trivial stuff like 'check if file exists'?

Re: PowerShell is open sourced and is available on Linux

#83

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.

As long as you bear in mind that it's main purpose is a usable replacement for the CMD.EXE batch language, then you should be willing to forgive Powershell it's warts.

Re: PowerShell is open sourced and is available on Linux

#85
post #65
post #51

Earlier quoted context omitted.

Which is why I have no doubt the Universal Windows Platform will become the Universal Platform and be a true desktop/tablet/mobile/server/etc Java competitor on all major OS (mobile, traditional and server). It must be rather frustrating for Microsoft to look back a decade or more and see they were sitting on the exact technology a hell of a lot of people said would be their future had they made it cross-platform fro…

But that's what .NET wanted to be. That's what Silverlight wanted to be.

Until now they didn't do what was necessary to make that a reality -- actually fully embrace other platforms.

Re: PowerShell is open sourced and is available on Linux

#86

Gates pioneered copyright protection for source code. Ballmer said Linux is cancer. This company has betrayed its own values. Actually it hasn't. The strategy is always the same: destroy the competition. Undersell. Even give away software for free. Whatever it takes. Money to burn. What's interesting is that they see the UNIX shell, which has long been open source and free, as competition.

Just like Google, Apple, IBM, etc. etc. etc.

I'll join in on the Microsoft bashing club when every other major corporation gets bashed the same way by devs. The day that will happen is when socialism makes more sense to people than capitalism, and it becomes a pervasive idea, but sadly, I think that day won't be coming around any time soon.

Until then, let's enjoy the fruits of capitalism.

Re: PowerShell is open sourced and is available on Linux

#87
Cool! I'm having a play with it and it seems to work really nicely. Does anyone know why the following commands don't produce the same output?

    get-childitem | ConvertTo-Csv
    get-childitem | ConvertTo-Json | ConvertFrom-Json | ConvertTo-Csv
It seems like, if there's a perfect underlying data model doing what's effectively an identity conversion shouldn't change anything.

Edit oooo, and all the linux stuff is available within it too. So you can run this to just augment your linux experience.

    ls | grep '_' | ConvertTo-Json

Re: PowerShell is open sourced and is available on Linux

#88

Gates pioneered copyright protection for source code. Ballmer said Linux is cancer. This company has betrayed its own values. Actually it hasn't. The strategy is always the same: destroy the competition. Undersell. Even give away software for free. Whatever it takes. Money to burn. What's interesting is that they see the UNIX shell, which has long been open source and free, as competition.

They see all things that flourish outside their control as competition.

Re: PowerShell is open sourced and is available on Linux

#89
post #32

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…

Is this really so useful in practice? I have never used PowerShell before (nor do I have plans to do so in the near future), but I would imagine the downside is complexity, both for user and especially for developers. With text you just read and parse, while with objects you need to know the object type, its fields,... Whatever happend, I hope text stays here (and I have a bad feeling about it ever since I met system…

> With text you just read and parse, while with objects you need to know the object type, its fields

parsing is actually a huge pain in general. a lot of unixy tools produce different output when their stdout is not a terminal to be more pipeline-friendly. That output is generally easier to parse (often tab-separated or so), but you still need to know the same things about the output (the "type" could be whether it came from `ps` or from `ls`, and the fields are just in some static order that was usually chosen decades ago, and if it's extensible it's cumbersome).

If `ps`, `ls`, etc produced typed output, I would be sooo happy.

When I worked at google I thought about what it would be like to have a unix userland where all the parts communicate with protobufs instead of raw text. There are some problems (like portability of message definitions, which was a solved problem within google, but which is harder when you have multiple parties/entities/companies contributing message definitions).

edit: accidentally a word

Re: PowerShell is open sourced and is available on Linux

#90
post #57
post #39

Earlier quoted context omitted.

Objects are discoverable in powershell. Enter the object, and lists the object out as text.

Ok, that sounds good. But what if some developer decided that some field would have prefix "ABC" in all values, then the value I am interested in, then some value I am not interested in at the end? (you say this can't happen? Clue: WMI.) Can I take the value, convert it to string, make some magic on it and convert it to another object entirely? I don't know, I never had any problems with text parsing. I love strong t…

Yep! There's a few ways to accomplish such a thing, but probably the most straight forward would be the Foreach-Object command (aliased as "%") to do a mapping from source object to something else. Free form objects/dictionaries are easy to make and consume.
Post reply on HN