Live data from Hacker News

Two Months with Powershell on a Unix

code.joejag.com

11–20 of 113 posts

Re: Two Months with Powershell on a Unix

#11
post #5

Earlier quoted context omitted.

I’m not sure I could cope with that. I have enough problems with it on windows. Literally every corner you turn something punches you in the balls or turns to dust in your hands. It’s one of the most frustrating things I’ve ever used and I avoid it where I can. I would not invite it onto a *nix machine voluntarily where there are established patterns and solutions which have matured over the space of 40 odd years now…

Where does that happen for you? In my experience with PowerShell on Windows, you have to approach it more like interactive python with shortcuts rather than a regular shell, and once you’re accustomed it works fine. The main issue is that it doesn’t work like a classic shell, it just has some affordances to look like a classic shell in common use cases.

Agreed; it's a lot more like a really weird iPython than it is a drop-in bourne shell replacement with quirks.

Re: Two Months with Powershell on a Unix

#13
post #5

Earlier quoted context omitted.

I’m not sure I could cope with that. I have enough problems with it on windows. Literally every corner you turn something punches you in the balls or turns to dust in your hands. It’s one of the most frustrating things I’ve ever used and I avoid it where I can. I would not invite it onto a *nix machine voluntarily where there are established patterns and solutions which have matured over the space of 40 odd years now…

Where does that happen for you? In my experience with PowerShell on Windows, you have to approach it more like interactive python with shortcuts rather than a regular shell, and once you’re accustomed it works fine. The main issue is that it doesn’t work like a classic shell, it just has some affordances to look like a classic shell in common use cases.

It's weird but once you get used to it I think it's cool. No more text munging!

Re: Two Months with Powershell on a Unix

#14
"so they do these cool things, which of necessity break a model some of you will have been familiar with for 50 years in some cases, but its amazing"

(in my case, 40 years.)

There is considerable merit in new things. But there are also costs. And, there is the proplist version of this story in OSX. So, I know this is a "thing"

Re: Two Months with Powershell on a Unix

#15
post #2

Dude has more patience than me. I tried running powershell on linux a few times, and every single time the second command I run is not supported on linux. I don't even remember what the commands were, PSremoting was one for sure and I think another was Invoke-WebRequest. Powershell on linux is a nice idea but in the current form it is in name only, as nearly nothing works.

Invoke-WebRequest doesn't even work correctly on windows for a large amount of very vanilla web functionality.

Powershell is a nice idea, but Microsoft is kidding themselves if they think it's even close to the alternatives.

Re: Two Months with Powershell on a Unix

#16
While I really would like UNIX shells to get the ability to pass structured data, one problem is that most shells out AFAIK there don't give the ability to pass structured data natively.

For these structured shells(like Powershell, elvish, Nushell) to succeed, they should...

* have a spec on how to pass structured data from a native executable (without function calls like 'from-json')

* implement some structured data functionality in all GNU coreutils at the very least

* and push the 'structured shell evangelists' to implement these schemes on other programs.

Re: Two Months with Powershell on a Unix

#17
post #4
post #2

Dude has more patience than me. I tried running powershell on linux a few times, and every single time the second command I run is not supported on linux. I don't even remember what the commands were, PSremoting was one for sure and I think another was Invoke-WebRequest. Powershell on linux is a nice idea but in the current form it is in name only, as nearly nothing works.

Invoke-WebRequest most certainly runs on linux.

This comment made me go and try out Invoke-WebRequest because I'd forgotten what it was like.

Being able to do simple web scraping like this in a "shell" is pretty great:

    $hn = Invoke-WebRequest https://news.ycombinator.com/
    $hn.AllElements | Where {$_.TagName -eq "a" } | Where { $_.Class -eq "StoryLink" } | select "innerHtml"

Re: Two Months with Powershell on a Unix

#18
post #17
post #4

Earlier quoted context omitted.

Invoke-WebRequest most certainly runs on linux.

This comment made me go and try out Invoke-WebRequest because I'd forgotten what it was like. Being able to do simple web scraping like this in a "shell" is pretty great: $hn = Invoke-WebRequest https://news.ycombinator.com/ $hn.AllElements | Where {$_.TagName -eq "a" } | Where { $_.Class -eq "StoryLink" } | select "innerHtml"

IWR and ConvertFrom-Json are what got me hooked on powershell. No more learning complex switches for curl or crazy JQ syntax. It's all built in and makes sense.

Re: Two Months with Powershell on a Unix

#19
I am dead serious. Powershell should replace (bash) shell scripting under any Linux.

I find shell scripts terrible, I've learned to switch to Python quickly, despite the overhead.

Powershell is very command-line friendly, with easy tab-completion of commands. I've worked with it extensively on Windows, creating large worklflows with it, it's very nice.

Powershell even has a unit test tool called 'pester' which is funny to me because it means 'bully' in my native language.

Post reply on HN