Live data from Hacker News

PowerShell is open sourced and is available on Linux

azure.microsoft.com

391–400 of 790 posts

Re: PowerShell is open sourced and is available on Linux

#391
post #93

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…

As a note, there have been strongly-typed shell languages for Unix for some time. Scheme Shell[0], Turtle[1] and TCSH[2] leap to mind; but there's nothing preventing a developer from using Perl, Python, Lisp or any other language that allows itself to accept stdin as an interpreted script. 0: https://scsh.net/ 1: http://www.haskellforall.com/2015/01/use-haskell-for-shell-s... 2: http://www.tcsh.org/Welcome Edit: oh m…

0: scsh is a nice scripting language, however it's not meant for interactive usage (PowerShell is) See: http://www.alphanet.ch/~schinz/scsh-faq/scsh-faq_4.html#SEC3... Scheme is also dynamically typed.

1: It's the first time I see it, but from a cursory glance and some docs (http://hackage.haskell.org/package/turtle-1.0.0/docs/Turtle-...) I think it doesn't include simply calling external commands (I couldn't find any info on how to wrap an external executable with type, too). Without this, it can't be a real "shell", only a scripting DSL for Haskell. It's not very good for interactive use as it relies on ghci.

2: tcsh is meant for interactive use and is a shell; I used it when working with FreeBSD but never wrote any scripts in it. However, I don't see any mention of types in it's manual (other than file types): http://linux.die.net/man/1/tcsh

PowerShell is statically typed like Turtle, has a nice scripting language like scsh and is meant for interactive use. It's not only typed, but also (partly) object oriented and with full and direct access to all .NET/Mono classes. That also implies that you can write commands in any of the CLR-targeting languages, by the way, like F# or Clojure-CLR.

PowerShell is unique (not literally so, as I'm sure there are other projects doing similar things, but I think it's safe to say that it's unique among widely used shells) in what it provides and in that it takes all that into interactive use. It's definitely worth checking out if you haven't already. Of course, keep in mind its problems, like the mentioned smaller number of already available utilities.

Re: PowerShell is open sourced and is available on Linux

#392

Windows can have a neat-o shell all they want but when you open powershell on a windows computer you still get the following when you try to ssh... so, not really seeing the point here: ssh : The term 'ssh' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

Wow your comment is bafflingly low quality and stupid. Perhaps you shouldn't have submitted it.

he's not wrong though. ssh is the quickest way of accessing remove machines, not to mention secure (i have never seen remote desktop done with priv/pub key in practice). it also makes automation and transferring files easy. putty is terrible compared to ssh on linux. what i would have given for good ssh on windows back when i was still doing C#...

Re: PowerShell is open sourced and is available on Linux

#393
post #134

Earlier quoted context omitted.

Let's hope the awesomeness they are showing on the developer relations side finally leaks into the Windows side and they stop their shenanigans with W10 and Android and VFAT patent threats. It's so disappointing to see this kind of split-brained behavior.

Nah, why should they? Developers are pretty much the only demographic that might realistically switch operating systems, so they only really need to cater to them. The rest, they can pretty much treat however they want, and they won't lose them as customers.

Exactly. The developers they can get to work for them are "useful idiots", whose work they then use to further screw over their main customers, who aren't going to abandon them no matter what, and also bring in more developers to their platform and away from the competition. As long as these developers are easily and naively wooed by a bunch of BS talk about "the new Microsoft", they get to help MS with their evil shenanigans.

Re: PowerShell is open sourced and is available on Linux

#394
post #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…

ConvertTo-CSV converts each property into a single string. Rich object? Tough. You get a string. If the type does not support a nice string representation, you get type names, like "System.Collections.Generic.List`1[System.String]" in your CSV output.

ConvertTo-Json serializes in-depth ... properties that are actually rich objects become nested dictionaries instead of simple strings. For instance, the "Parent" which is a Folder object. Recursively, up to the depth allowed.

Anyway, when you convert back, you don't get actual FileInfo and DirectoryInfo objects, you get dynamic property bags. So those complex properties remain dictionaries ... which ConvertTo-CSV turns into strings in a very different way.

If you specify -Depth 1 when you ConvertTo-Json ... the resulting output would be very similar.

Re: PowerShell is open sourced and is available on Linux

#396

Earlier quoted context omitted.

Tell me how well EEE works with an optional application released on Github with an MIT license will work.

GitHub is just the distribution here, and software licenses are subject to change. That's the embrace portion. Hypothetically, Powershell becomes widely used on Unix, and Microsoft releases Powershell 2, which extends Powershell. This version only runs on Windows and contains killer features. These new features can't be implemented from the GitHub source either technically or because of intellectual property. That's…

So then you switch back to another shell?

Re: PowerShell is open sourced and is available on Linux

#397

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. How are Python/Ruby/Perl going to give you structured objects from "ps"? That's the promise of object-based pipes. You can get useful records out of your command-line tools without having to write an ad-hoc regex.

I find that to be the issue. You are considering it just RAW text when it is actually formatted text that has been parsable for years with common unix command line tools. It not being in the format you consider a structured object does not mean it's not a object or even parsable. If you are using ad hoc regex I suspect you are not using all the tools available to you. I feel like Kernighan and Pike do a much better j…

So much this.

What the M$ community fails to see is that text streams can be consumed by __everyone__. We've basically all accepted the fact that programs are used longer and in different ways than we'd expect. A brittle object model can only lead to vendor lock in and indigestible output.

Re: PowerShell is open sourced and is available on Linux

#398

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

I know the problem you are talking about - it has bitten all of us. The new language mode you use when writing classes in PowerShell shifts the needle more towards programming semantics than shell semantics and addresses this. Give it a try! Jeffrey Snover [MSFT]

I really like the functional approach of PowerShell. The pipeline, while not the end-all-be-all of perfection, is still very, very good and very flexible. Once you get into the functional mindset, it is very easy to write terse, powerful code.

My real wish is that there was a syntax for writing function decorators and function generators. This would be similar to the [cmdletbinding()] syntax, but would allow me to write my own.

Re: PowerShell is open sourced and is available on Linux

#399
I just spent all day trying to figure out why Invoke-SqlCmd only works in certain extremely convoluted ways. I'm going to assume this has more to do with the Sql Server team than it does to do with the powershell team, but still: I cannot be excited about anything to do with Powershell since I'm now up to like 10 Googles per line.

Re: PowerShell is open sourced and is available on Linux

#400

Earlier quoted context omitted.

So many strongly typed shells exist already. I don't understand why arbitrary microsoft shit gets so much love for doing things that have already been done in the OSS world, and doing them poorly. PowerShell is a pile of shit.

I take a super utilitarian view. At the end of the day, PowerShell on Linux is another tool in the toolchest. PowerShell has a POV about abstracting gorp into high level task oriented abstractions, object pipelines, structured data, and the workflow from interactive shells to ad hoc scripts to formal scripts to production scripting. That is what a number of people are looking for in their tools and that is why they l…

I admire how polite your responses to these posts are. Kudos.
Post reply on HN