Live data from Hacker News

PowerShell is open sourced and is available on Linux

azure.microsoft.com

761–770 of 790 posts

Re: PowerShell is open sourced and is available on Linux

#761
post #242

Earlier 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…

> Sure, it beats Java, but the VM is worse for running other languages,

based on what criteria?

Re: PowerShell is open sourced and is available on Linux

#762
post #501
post #408

Earlier 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…

This is a really strange argument -- he's saying that PowerShell was designed so that you could more easily move from shell to script to library ... Your counter is -- you don't do that? Of course you don't, because your shell is bash. That's exactly the point. If your shell is bash, when you write a script you use a different language. What if there was a shell where you could actually script ... You're absolutely r…

> it has made compromises (like using comparison operators like -eq instead of ==).

wat.

The use of -eq instead of == is a compromise?

I don't get that.

Re: PowerShell is open sourced and is available on Linux

#763
post #752

Earlier quoted context omitted.

You could just use WSH (Windows Scripting Host) with either VBScript or JScript the way you've always been able to. AFAIK, Windows has shipped with that scripting solution since like Windows 2000 or possibly even earlier.

I noticed that on old computers (Windows 95, I think, and certainly 2000 and XP) where it would classify .js files as executables. I was about 11-14 so I didn't understand much of Windows at the time, let alone in a foreign language (I'm Dutch) when I wasn't even allowed to use the Internet (dialing up was expensive per-minute stuff), but yeah I remember that. Still, I've never heard of anyone using Javascript or VBS…

> I've never heard of anyone using Javascript or VBScript to automate anything.

as just one example, It's common to include JavaScript or VBScript steps in Windows installers. You would never know it, if you ran an installer that used a script to automate a few things.

Re: PowerShell is open sourced and is available on Linux

#764
post #501
post #408

Earlier 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…

This is a really strange argument -- he's saying that PowerShell was designed so that you could more easily move from shell to script to library ... Your counter is -- you don't do that? Of course you don't, because your shell is bash. That's exactly the point. If your shell is bash, when you write a script you use a different language. What if there was a shell where you could actually script ... You're absolutely r…

> If your shell is bash, when you write a script you use a different language.

The number of bash scripts I see for various -n-x related tasks suggests that this is substantially untrue; people do, in fact, do scripts in bash.

> What if there was a shell where you could actually script ...

I can't think of any shell that you can't script. OTOH, interactive use and scripting are substantially different use cases, so it really makes sense to have both interactive-optimized languages that may be usable in script and scripting languages that may be usable interactively, but focus use of each in their optimized role.

Re: PowerShell is open sourced and is available on Linux

#765

Earlier quoted context omitted.

> JACK > simple to set up Try getting it to run with basically anything, seriously. Pulseaudio is plug-and-play. > Which init system "just works" Neither of the ones you mention fit that description > It's an init system that's also a cron replacement Wrong. SystemD is a project with a similar branding issue that KDE has. Systemd is a project. It develops a set of libraries. And, on top of that, an init system. And a…

>I can write systemd unit files in a few minutes, can easily stream syslog over the network from multiple servers and aggregate, I can easily handle namespacing of software. You could do 2 of those three things already (syslog and namespacing), and bsdinit init files aren't hard to right. >Systemd is a project. >It develops a set of libraries. >And, on top of that, an init system. >And a cron replacement. >And a sysl…

> That's BS. A lot of it's all one executable.

That’s not even true if you use the packages for debian or redhat. In both cases, it’s over a dozen packages for systemds independent projects, and you can replace each of them seperately, if you wish to.

I’ve done so in the past on a server where I couldn’t update everything because it was an old-style containerized VPS with shared kernel.

> Well, if you want Windows, you know where to find it. But stop trying to turn my UNIX into it.

> Well, you're in an EXTREME minority.

Then go and use UNIX, aka BSD. This is the linux world, and most people want it – as seen in the countless times when distro maintainers held a vote pro or con systemd.

> ...and if you think "the year of linux on the desktop" is ever coming, you're delusional. Besides, Ubuntu had a reasonable UX for that audience long before systemd came around.

Does Ubuntu allow me to configure all services and systems via a neat UI? No? Why? Because it still uses a flawed file-based approach, which is useless in the 21st century.

Ubuntu replaced user-facing UX, but even there not everything could be properly done yet.

Despite that, Ubuntu also created their own init system, display server, syslog daemon, and a registry for configs.

So, they had the same stuff systemd now provides, and more.

> You could do 2 of those three things already (syslog and namespacing), and bsdinit init files aren't hard to right.

> Software namespacing doesn't require systemd. Syslog streaming has been a thing for a long time. And BSDinit, s6-rc, runit, openrc, sheperd, nosh, systemXVI, perp, watchman, and a variety of other init systems exist that make writing unit files easy. Many of them predate systemd.

I’ve tried unit files for other init systems, it was a pain in the ass.

Systemd is the first where every software provides matching unit files, I can easily write my own, and it just works.

Again, the entire point is that it just works and is still easily configurable and modularized.

Re: PowerShell is open sourced and is available on Linux

#766
post #415

Earlier quoted context omitted.

We've banned this account for repeatedly violating the guidelines. If you'd like to commit to only commenting civilly and substantively, you can email hn@ycombinator.com and we'll happily unban the account if we believe you'll do so.

So, if you disagree with an HN celebrity, you can get banned? good thing my argument with tptacek happened before you came on-board.

"Be civil. Don't say things you wouldn't say in a face-to-face conversation. Avoid gratuitous negativity."

That's pretty clear, and has been in the guidelines since long before sctb was a mod.

Re: PowerShell is open sourced and is available on Linux

#767

Earlier quoted context omitted.

It is just another tool in the toolchest. As you know, on Linux, there are tons of great interactive shells and it is sortof a lifestyle choice. You might want to kick the tires and see whether it fits your lifestyle or not. If you use Bash as your shell, think of PowerShell as you would python or perl - something you write scripts in and call from Bash. Jeffrey Snover [MSFT]

does powershell compile to IL? is it possible to create stand-alone executables from it that do not depend on the runtime?

We have a hotspot compiler.

We have talked about having it create a stand-alone executable but it has always fallen below the cut line.

Jeffrey Snover [MSFT]

Re: PowerShell is open sourced and is available on Linux

#768

Earlier quoted context omitted.

Oh, I forgot: the comment you showed wouldn't trigger my AWK script. Read it more carefully.

Yes it will. If you mean the $2 part, the comment character takes the place of $1. Or did you mean something else? (either way, I tested it before posting)

Nope, you're right. I just miscounted.

You could always add

  && $1 != "#" 
To fix this, though.

Re: PowerShell is open sourced and is available on Linux

#769

Earlier quoted context omitted.

>I can write systemd unit files in a few minutes, can easily stream syslog over the network from multiple servers and aggregate, I can easily handle namespacing of software. You could do 2 of those three things already (syslog and namespacing), and bsdinit init files aren't hard to right. >Systemd is a project. >It develops a set of libraries. >And, on top of that, an init system. >And a cron replacement. >And a sysl…

> That's BS. A lot of it's all one executable. That’s not even true if you use the packages for debian or redhat. In both cases, it’s over a dozen packages for systemds independent projects, and you can replace each of them seperately, if you wish to. I’ve done so in the past on a server where I couldn’t update everything because it was an old-style containerized VPS with shared kernel. > Well, if you want Windows, y…

It's not modular, it's a mess. Systemd may be organized into separte components, but make no mistake - it's a monolith in sheep's clothing.

As for unit files, nosh, at least, provides the same format as systemd. s6 "unit files" are just the command to daemonize the process, in most cases. BSDinit and OpenRC are pretty simple as well.

>Then go and use UNIX, aka BSD. This is the linux world, and most people want it – as seen in the countless times when distro maintainers held a vote pro or con systemd.

Linux is a UNIX too, and most of the people who know and care about init systems don't want it, judging by the massive protests that show up constantly from people who understand the technical aspects.

>Again, the entire point is that it just works and is still easily configurable and modularized.

It "just works," but it's a technically deficient mess that goes against everything unix is about, is a monolithic beast in disguise, and is trying to force everyone to use it.

If it weren't for that last bit, I really wouldn't care.

Re: PowerShell is open sourced and is available on Linux

#770

Is there anything preventing Microsoft from putting a Linux shell natively on Windows? I'm sure PowerShell is awesome, but the DevOps person in me is not excited at all.

That is how we got started on this. We didn't want to invent anything here. We had a technology called Services for Unix which provided all the shells and utils and I got 99.5% of the way to getting that shipped natively in Windows but it got hung up over IP concerns. So we made it free instead.

It turns out it didn't help managing Windows at all.

The heart of the problem is that Unix is a Document-oriented OS and Windows is an API-oriented OS. In Unix, if you can edit a file and restart a process - you can do most management tasks. Therefore text processing utils like awk, sed, grep are actually management tools. When these became available on Windows - they didn't help manage anything because awk didn't work against the registry, sed didn't work against WMI, grep didn't work against Active Directory. An API-oriented OS needed an API-oriented solution.

That is why we HAD to invent PowerShell. I believed that the Unix automation model was fundamentally correct: Interactive shell composing small tools together in ad hoc ways to quickly construct novel solutions to novel problems. I like to call this the " A | B | C" model.

I did a deep rethink of the "A | B | C" model and asked myself the question WHY? Why not just type A? Why didn't A do what I wanted it to do?

There is the traditional answer about toolchest of tiny tools but I keep chewing on it and came up with a different answer:

  A tightly binds 3 steps into 1.  It

   1) Gets a set of objects

   2) Processes those objects

   3) Outputs those objects (typically as text)
When when we say A doesn't do what I want it to do, what I'm REALLY saying is that A did one of those 3 steps in a way I didn't want. So piping the results to B and C is REALLY all about taking the text and reverse engineering my way back to the original objects to do one of the steps differently.

My observation was that the pipeline should go between the 3 (smaller) steps and that the pipeline should pass objects and only output to text when you wanted text.

This object orientation is one of the great simplifies of PowerShell. It allows us to shift our focus from the mechanics of text parsing to the semantics of what I want to achieve. We like to call this THINK, TYPE, GET.

THINK about what you want.

Type it

Get it

Imagine you wanted to get all the processes whose workingset was greater than 5mb and sort it by workingset and then format that as a table just showing the name the id and the workingset - in PowerShell, you would do that with this:

PS> Get-Process | Where workingset -ge 5mb |sort workingset | format-table name,id,workingset

some people complain about the verbosity of PowerShell but that is there for scripts. We have lots of aliases for interactive use. Here is an equiv:

PS> gps|? workingset -ge 5mb|sort workingset|ft name,id,workingset

So that is the answer - a lot of the great Unix tools don't work on Windows because it is an API-oriented OS. So we had to develop an API-oriented automation model - that is PowerShell.

Jeffrey Snover [MSFT]

Post reply on HN