Live data from Hacker News

Two Months with Powershell on a Unix

code.joejag.com

81–90 of 113 posts

Re: Two Months with Powershell on a Unix

#81
post #54

I spent some time with Powershell on Windows recently, more time than I am used to. Powershell is a clear winner over CMD.EXE by a mile, but… - As an interactive shell, it suffers from an ecosystem which is much poorer than the bash/zsh ecosystem, - As a scripting language, I’m going to use Python or Go the moment anything becomes larger than a few lines, - Installing Posh Git is just a really mediocre experience (in…

My biggest issue with powershell is how undiscoverable it is. Good luck doing anything without searching for commands in a web browser. But maybe that's just a result if it being so new. 'ls' has been around for almost 50 years... What it really feels like is a complete programming language inside of notepad.exe because of the historically terrible windows command prompt.

> But maybe that's just a result if it being so new. 'ls' has been around for almost 50 years...

Even so, I don't think we can use that excuse given that it was released over 13 years ago...

Re: Two Months with Powershell on a Unix

#82

Earlier quoted context omitted.

I was just thinking "could this be it? Another Microsoft product that I start voluntarily using? (besides VSCode)" and then I go to the comments and the first comment I see reveals the Microsoft stink.

VSCode has telemetry too. https://code.visualstudio.com/docs/getstarted/telemetry

Oh yeah, I know, but I expect that from a big electron app and it asked me if I wanted to opt out on first launch. This is the same way Firefox and many other respectable programs do it and I see no problem with that.

But putting it in a shell with no prompt and only an unset environment variable to disable it, that's more like the Microsoft we all know.

Re: Two Months with Powershell on a Unix

#83
post #72
post #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"

There are often more costs in sticking with the same tech for forty years...I would still be coding for DOS...I hope with new generations of devs will come better tools...as well as a greater willingness to move on...

Why? Are you afraid your software is going to wear out on you?

Re: Two Months with Powershell on a Unix

#84
post #65

here is my opinion on `When X is going to replace bash?` The story goes on like this: You went to DataCentre, logged in to an internal machine, something happened (eg failure, diagnostic necessary et.al.) which you need to fix. given condition, you don't have internet connection inside (air-gapped) - You most likely have man-pages installed and having examples what to do in them, - `--help` yields some sensible outpu…

Given that example, good luck trying to log into a DataCenter that still uses classical UNIX with either sh or ksh as their only options.

Bash also has not replaced all other UNIX shells.

Re: Two Months with Powershell on a Unix

#85
The problem with powershell on Unix/Linux is that there is an implicit assumption everywhere that there is a shell available. If you look at simple git StackOverflow questions like "how do I get the oldest common ancestor commit for two branches", you'll happily see people answer with combinations of shell commands that assumes that there is a sh (or some times even bash or zsh!). Absolute madness that git can't do basic things without relying on external applications that may or may not exist.

Re: Two Months with Powershell on a Unix

#86
post #8

I've been using Unix for 20+ years, switched to pwsh as my main shell 4 years ago (on both Windows and macOS). Here's my notes: https://github.com/mikemaccana/powershell-profile/ Last few weeks I've been going back to bash, mainly to try out WSL/Ubuntu's defaults, but will probably move to pwsh there too. I like the consistent naming (which means I can guess commands) and avoiding the scraping that's inherent in text…

Hey thanks for this, nushell looks really interesting! I really like the idea of an objective shell but don't like the verbosity of PowerShell inputs. I think if you go through my post history I actually describe wanting something like Nushell, not knowing it existed!

Tbf most common PowerShell commands have short aliases for interactive use. I like that I can use the long forms in scripting and aliases on command line.

For example in my PS (unsure who created aliases because I think some aren't default) I have both "ls" and "dir" for "Get-Childitem", "wget" for "Invoke-Webrequest" and so on.

Re: Two Months with Powershell on a Unix

#87
post #54

I spent some time with Powershell on Windows recently, more time than I am used to. Powershell is a clear winner over CMD.EXE by a mile, but… - As an interactive shell, it suffers from an ecosystem which is much poorer than the bash/zsh ecosystem, - As a scripting language, I’m going to use Python or Go the moment anything becomes larger than a few lines, - Installing Posh Git is just a really mediocre experience (in…

My biggest issue with powershell is how undiscoverable it is. Good luck doing anything without searching for commands in a web browser. But maybe that's just a result if it being so new. 'ls' has been around for almost 50 years... What it really feels like is a complete programming language inside of notepad.exe because of the historically terrible windows command prompt.

If you know “get-command”, “get-member” and “help”, it’s quite discoverable.

Re: Two Months with Powershell on a Unix

#88

The problem with powershell on Unix/Linux is that there is an implicit assumption everywhere that there is a shell available. If you look at simple git StackOverflow questions like "how do I get the oldest common ancestor commit for two branches", you'll happily see people answer with combinations of shell commands that assumes that there is a sh (or some times even bash or zsh!). Absolute madness that git can't do b…

It's not madness, it's the price of flexibility and one that I am personally gladly to pay. I am forced to use Windows and pre-approved tooling daily at work, you can't imagine what a relief it is to use Linux at home, where you can chain together the exact programs that you want and make them work the way you want.

Re: Two Months with Powershell on a Unix

#89
post #54

I spent some time with Powershell on Windows recently, more time than I am used to. Powershell is a clear winner over CMD.EXE by a mile, but… - As an interactive shell, it suffers from an ecosystem which is much poorer than the bash/zsh ecosystem, - As a scripting language, I’m going to use Python or Go the moment anything becomes larger than a few lines, - Installing Posh Git is just a really mediocre experience (in…

My biggest issue with powershell is how undiscoverable it is. Good luck doing anything without searching for commands in a web browser. But maybe that's just a result if it being so new. 'ls' has been around for almost 50 years... What it really feels like is a complete programming language inside of notepad.exe because of the historically terrible windows command prompt.

I've mentioned this in other Powershell HN threads but you might want to try these two commands to make discoverability much better IMHO:

Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete

Set-PSReadLineOption -ShowToolTips

Also note that you can get in-console help on most commands without having to go out to a web browser. On the ones I've tried, examples are also included which help output too.

Help will also list available commands; eg:

help json

Shows me the three commands available from my shell: ConvertFrom-Json, ConvertTo-Json and Test-Json.

There is also Get-Command, which you can filter for command discovery, ie:

Get-Command | where Name -Like "Json"

The advantage to PowerShell being object-based here is that if you press after typing where, the list of completions you get will include the properties that are in the object returned as the result of Get-Command.

I also use Cmder for a much nicer console than cmd.exe. I haven't tried the latest version of the new Windows Terminal but I hear it's also nice.

Re: Two Months with Powershell on a Unix

#90
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.

Well it’s not the concept but the implementation that is at fault. From persistent random WinRM failures, sudden things breaking and the whole thing wrapping rancid bits of WMI and COM which leak through regularly, it’s just pain. On top of that the interface is somewhat flakey and slow. Plus some of the semantics feel like going back to circa 1995 Perl. Oh and don’t get me started on the nightmare that is script signing and security which really does nothing useful other than get in the way.

It really feels immature.

The biggest travesty is when it is integrated into something else such as ansible, packer, chocolatey etc where it will cost you a couple of days occasionally due to some obscure issue hidden behind even more layers.

Post reply on HN