Earlier quoted context omitted.
> So, yes, someone did ask for it - the IT industry. ... who couldn't use the well-known mature shell tools since they were locked into a closed platform, and Windows' cmd.exe was comparatively very weak.
It wasn't cmd that was the problem (although, it is weak); it was how Windows exposed APIs to allow automated solutions. You had two options: VBScript (which is a glorified COM+ agent) or a "real" programming language like VB6/C# which mixed COM+ with Win32 API calls (which are too hard to use for most non-programmers). Powershell within itself does improve CMD. But that isn't primarily how PS pushed Windows automati…
PowerShell is open sourced and is available on Linux
611–620 of 790 posts
Re: PowerShell is open sourced and is available on Linux
#612Earlier quoted context omitted.
The dollar sign is charming. There's a few points here: 1) Not all data is text. In fact, very little of the data people see/work with day-to-day is raw text. It's silly to transform a PNG image into text to be able to pipe it around. (Or to pipe around its filename instead and have a dozen tools all having to open and re-parse it each time.) 2) There's nothing on PowerShell preventing you from serializing a piece of…
> Even if you come up with a great way to improve the output, doesn't matter, you've still broken everything. You phrase this as if changing things for the sake of changing was a good thing. It is not. Well, perhaps it is good for the software vendor, but from the customer's point of view, having to re-learn how to do the same stuff over and over every other year is a PITA.
Re: PowerShell is open sourced and is available on Linux
#613Earlier quoted context omitted.
That doesn't work either. [kapil@localhost ~]$ ip addr | awk '/inet / { print $2 }' 127.0.0.1/8 192.168.128.236/24 [kapil@localhost ~]$ You guys are just proving my point. _I_ already know how to do it using bash. Its just that using objects and querying properties is far simpler . And I just took a random example because its a common thing that someone would want to do.
I think what others might be demonstrated is that there isn't a reliance on what object Microsoft decides to ship to you, in *nix we can combine commands and builtins and get the information in the structure we need without having to wait 8 months for a system reboot (or worse a paid for upgrade) that will give us what we need.
I think the idea of an object pipeline is sound for precisely this reason, but I don't think it should be connected to any one language or platform.
Re: PowerShell is open sourced and is available on Linux
#614Re: PowerShell is open sourced and is available on Linux
#615Earlier quoted context omitted.
After a number of years using PowerShell, my conclusion is the opposite: text "scraping" is just better for most cases. Normal shell usage means doing a lot of one-shot pipelines incrementally. This is just easier and faster to do when passing text around because you can look at it and not have to inspect some object for it's type and what attributes/methods it provides. Parsing the text is not the problem here (alth…
> And the over-verbose syntax doesn't help This is basically the reason I have not been willing to put any time even trying to learn ps. I mean, trying to translate unzip file.zip folder To ps was a nigthmare. Like: [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath) I don't _want_ to learn to type stuff like that for simple shell scripts.
Expand-Archive file.zip
Re: PowerShell is open sourced and is available on Linux
#616Earlier quoted context omitted.
After a number of years using PowerShell, my conclusion is the opposite: text "scraping" is just better for most cases. Normal shell usage means doing a lot of one-shot pipelines incrementally. This is just easier and faster to do when passing text around because you can look at it and not have to inspect some object for it's type and what attributes/methods it provides. Parsing the text is not the problem here (alth…
> And the over-verbose syntax doesn't help This is basically the reason I have not been willing to put any time even trying to learn ps. I mean, trying to translate unzip file.zip folder To ps was a nigthmare. Like: [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath) I don't _want_ to learn to type stuff like that for simple shell scripts.
a. You can still use the native binary just as well. Especially in this case.
b. There was no PowerShell cmdlet for it at the time. There also isn't one for executing Python code, you still have to call python. Or, if you're so inclined, load up IronPython's assembly, and use an overly verbose .NET method call ...
c. There now is a cmdlet for doing so: Expand-ZipFile.
I'm actually curious as to those complaints: Do you never write a function in bash to abstract away something? A function in other languages? Is everything just a series of crystal-clear one-liners?
Shell scripts in Unix-likes tend to glue together a bunch of other programs and (usually) not do much programming in the shell's language. You can write PowerShell just the same, actually. It is a shell, after all.
Re: PowerShell is open sourced and is available on Linux
#617Earlier quoted context omitted.
except that C# as a language is by leaps and bounds better than Java (both in syntax and useful features departments), so there have been other problems to solve, too.
Sure, it beats Java, but the VM is worse for running other languages, and that's where .NET loses. F# tries to be nice, but reified generics are more of a limitation than help in that world. In JVM land, now Java just hands you some specific well tested libraries: You write business code with Scala or Clojure, which I'd pick over C# by about as much as I'd pick C# over Java 7. That said, I have far more faith in Micr…
Re: PowerShell is open sourced and is available on Linux
#618Earlier quoted context omitted.
> 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. Parsing command output with sed/awk/etc (ie. "common unix command line tools") is absolutely an ad hoc parser. Let me give you an example that I recently ran into. I have a tool that parses the output of "readelf -sW", which dumps symbols and their sizes. The output normally…
I would like to see how it will look in PowerShell. $(readelf).ShowMeTheSecondStringFromTheEnd or $(readelf).PrintTheLastColumnInHeX?
Of course, for wrapping the native command you'd still have to do text parsing if you want objects. This was more as a comparison of the different worlds here not so much as "if I ran readelf in PowerShell it would get magically different output".
Re: PowerShell is open sourced and is available on Linux
#619Earlier quoted context omitted.
I never said anything about not liking command line tools. In fact I love them and think they do a awesome job! In any case you just proved my point. You think its insane to parse binary data while scripting and I do too. That is why I think the passing binary objects is insane on the shell. Now if you were talking about text base objects (not binary ones) then that is an entirely different story and I feel that is w…
This isn't about binary vs text, it is about structured vs. unstructured. The legacy of UNIX is flat text. Yes it may be expressing some underlying structure, but you can't access that structure unless you write a parser. Writing that parser is error-prone and unnecessary cognitive burden. PowerShell makes it so the structure of objects is automatically propagated between processes. This is undeniably an improvement.…
They are .NET objects, which, in some cases wrap COM or WMI objects. The nice thing about them isn't just properties, though. You can also have methods. E.g. the service objects you get from Get-Service have a Start() and Stop() method; Process objects returned from Get-Process allow you to interact with that process. Basically wherever a .NET class already existed to encapsulate the information, that was used which gets you a lot more functionality than just the data contained in properties.
Re: PowerShell is open sourced and is available on Linux
#620Earlier quoted context omitted.
That is not quite right either. I enter about 200 commands on a normal workday and write maybe two scripts a month in a shell language. A shell language should be a shell language, it's not merely a stepping stone to write a script after using a command just once. If that's what I'm looking for I'll use Python. And from the other side, Python would be a terrible shell (by default), and that's fine because that's not…
I thought Windows shipped with .NET which includes a command line C# compiler, csc.exe.