Live data from Hacker News

PowerShell is open sourced and is available on Linux

azure.microsoft.com

701–710 of 790 posts

Re: PowerShell is open sourced and is available on Linux

#701

Earlier quoted context omitted.

$mysql_cmd|awk -F\| '$2 == "what you want the second row to match" {print $0}' Not that much more work. And you can do better if you can coax mysql to emit proper DSV.

That kind of stuff adds up fast in an interactive shell.

...Which is why you write a script to do it if it comes up often.

Extendable tooling!

Re: PowerShell is open sourced and is available on Linux

#702
post #517

Earlier quoted context omitted.

Does tmux work well on Windows? Everything Microsoft has been doing recently with bash on Windows has made me consider buying a surface pro as my next machine.

I have Surface Pro 4 i5 and while I personally love it- I can't really recommend it due to various issues (battery life is shit, sleep is bugridden so best to hibernate only). It's uncomfortable as a tablet, and near useless for the main thing ultra light computers are used - traveling a lot. I use it at home. The pros are a really tiny size, yet it packs sufficient computing power for many things, awesome screen. I…

It really is annoying that the battery issues are so persistent. That's the main thing that has kept me from even going to a store to check one out.

I've been stalking /r/surface and I've been seeing complaints about this for over 6 months. Apparently it's more Intel's fault than Microsoft's, but still very disappointing. I love the form factor and I want to support Microsoft lately.

Re: PowerShell is open sourced and is available on Linux

#703
I think PS is miles above CMD but there are still things that bug me. For one, loading scripts into the current session is super confusing to me. Sometimes they are automatically available, other times I have to load them, still others aren't available at all. I'm guessing there is some way to "install" scripts so that they become cmdlets but I don't know what it is.

Another big problem I've had is backgrounding commands. There are multiple ways to do it and I always seem to pick the wrong one. For example, I want to install a bunch of things with Chocolate so I do a lot of Start-Process commands, but they seem to run serially and not in parallel. It's just very difficult to manage jobs in PS, or at least I haven't found any good information on how to do it properly.

Re: PowerShell is open sourced and is available on Linux

#704
post #256

Earlier quoted context omitted.

Could you elaborate on what the actual complexity is, rather than what you imagine? For a developer writing a tool, exposing an interface as objects is far easier than having to constantly serialize data into a string. Keep in mind that once you serialize data into a string, you can never change the order of the data or else other tools will break. Not so with a object based interface. In other system-admin type task…

And how to delete files older 2 days? Get-Files / | select olderThan 2 | Delete-File ? But it's not bash, it's coreutils find ./ -mtime +2 | xargs rm

    ls|? LastWriteTime -lt (date).AddDays(-2)|rm

Re: PowerShell is open sourced and is available on Linux

#705
post #110

Earlier quoted context omitted.

Powershell isn't competing with bash, it's competing with Python. So then, how does it compare against Python? While plenty of small scripts are still done with bash, I think Python is pretty common for serious production needs. I use it for virtually all scripting these days. I had a recent experience where a developer spent a day and couldn't get Powershell's webrequest library to do what he wanted. I was able to a…

Sure, there are different ways to do various things, especially depending on what one is familiar with and what the task at hand is. It sounds more like you knew how to get something done with your tools faster than the other guy/gal in this case. :)

[deleted]

Re: PowerShell is open sourced and is available on Linux

#706
post #506

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…

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…

> text "scraping" is just better for most cases.

Unix pipes handle bytes, not just text. For instance, copy a hard disk partition to a remote hard disk via ssh:

  (dd if=/dev/hda1) | (ssh root@host dd of=/dev/sda1)
The KISS principle ("Keep it simple, Stupid") is the best way in many cases. In Unix you can quickly enter a pipe without special coding which does also non-trivial stuff. For instance,

  find -name "*.xls" -exec echo -n '"{}" ' \; | xargs xls2csv | grep "Miller" | sort 
gets a sorted list of all entries in all Excel files which contain the name "Miller", no matter how deeply the files are located in the directories. Can you do this in Powershell quickly? I don't know, I am actually curious.

Objects in pipes are convenient and powerful. However, for most applications of pipes they are probably overkill. If things get tough you can simply use files rather than objects.

I would not be surprised if many Windows users will prefer bash pipes from the Ubuntu subsystem in Windows 10 rather than Powershell because it is much more handy for most pipe applications.

Re: PowerShell is open sourced and is available on Linux

#707

PowerShell is interesting, and I don't consider it evil. I know some people swear by it, and I am not one of those people - I'll take my AWK with a side of Ruby/Python, and a helping of SCSH, thank you very much. It does seem a bit out of place in a UNIX system, though. In Windows, PowerShell ties to a ton of strongly typed databases (SysReg, &c) and windows APIs together into a nice package. But on UNIXes, those API…

> In Windows, PowerShell ties to a ton of strongly typed databases (SysReg, &c) and windows APIs together into a nice package. […] > UNIX data is typically stored as text, or can be extracted as such easily. They could ally with the systemd folks in their mission to change that.

Which I’d be very happy about – see also the discussion about getting the ip for an interface above.

Re: PowerShell is open sourced and is available on Linux

#708

Earlier quoted context omitted.

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…

> I think it doesn't include simply calling external commands proc and inshell. Did you check out the built-in tutorial? http://hackage.haskell.org/package/turtle-1.0.0/docs/Turtle-...

Yes, I skimmed it. But please note that I wrote about "simply" calling external executables, where you can just type the name of a program and have it run. Turtle doesn't even try to allow this (while PowerShell has it), instead going in the opposite direction:

> Most of the commands in this library do not actually invoke an external shell or program. Instead, they indirectly wrap other Haskell libraries that bind to C code.

Re: PowerShell is open sourced and is available on Linux

#709

Earlier quoted context omitted.

> Windows did flourish... Sure. Just see all those buildings full of Windows servers running Facebook, Google, Twitter, Amazon...

It's moving the goal posts a bit to suddenly restrict this discussion to only servers, no? There are plenty of Windows servers running plenty of businesses. They may not outnumber non-Windows servers, but I don't think "majority" has to be a prerequisite for "flourish". There are also buildings full of Windows clients...

This discussion is about PowerShell, which is primarily intended to automate server management and has been ported to Linux, presumably, for the same purpose.

Re: PowerShell is open sourced and is available on Linux

#710

Earlier quoted context omitted.

> In Windows, PowerShell ties to a ton of strongly typed databases (SysReg, &c) and windows APIs together into a nice package. […] > UNIX data is typically stored as text, or can be extracted as such easily. They could ally with the systemd folks in their mission to change that.

Which I’d be very happy about – see also the discussion about getting the ip for an interface above.

Are you out of your mind? Or do you just not understand what you're saying? Adding an interface to PS to get this info natively is good. But Lennart has a magic ability to get everything wrong, and he's NOT messing with my fstab any more than he already has.
Post reply on HN