Live data from Hacker News

Two Months with Powershell on a Unix

code.joejag.com

71–80 of 113 posts

Re: Two Months with Powershell on a Unix

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

Re: Two Months with Powershell on a Unix

#73
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'm sure it's fine if you live in it all the time but if you only use it occasionally it becomes hard work.

Re: Two Months with Powershell on a Unix

#74
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'd say it's not any less discoverable than the typical Unix shell, plus readability is guaranteed when coming across scripts written by someone else. Crypticism is culturally out of place in Powershell, and I think this is its best feature.

PS: the ISE (Integrated Scripting Environment) helps when writing scripts.

Re: Two Months with Powershell on a Unix

#75

>For example, if we wanted to get the first three files from ls I’d do something like `ls | head -n 3`. In Powershell, it’s `$(dir)[0..2]` since the dir command is returning an array which I can index into. You could do that, but the way to write it in the bash way would be `dir | select -first 3` >a quick Google told me to use `echo | openssl s_client -showcerts -servername joejag.com -connect joejag.com:443 2>/dev/…

The echo problem is reflective of a larger, longer-term issue with PowerShell, that being that it sometimes aliases PowerShell commands to the names of equivalent Unix commands. That’s done to ease the transition into PS-land for Unix folks, of course. But unless the PowerShell command works exactly the same as the Unix command it’s aliased to — takes all the same arguments, returns all the same data structures and error codes, etc. — you inevitably run into cases where things break because echo or curl or whatever aren’t behaving the way your code expects them to.

Re: Two Months with Powershell on a Unix

#76
post #69
post #54

Earlier quoted context omitted.

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.

Yes, but, POSIX shells aren’t that much more discoverable, either. It takes loads of reading and trial and error to become competent in any command line.

I would argue that the strict posix shell (with all its limitations) can be learnt in an afternoon or two and a lot of it will be also useful in general in the OS. like utilities and their inputs and outputs. it's mostly reusing/duct taping existing programs, so it's not a vacuum like a DSL. I hope it has excellent man pages to be usable. the BSDs have...

Re: Two Months with Powershell on a Unix

#77
post #7

If you don't want PowerShell reporting your activities back to the mothership, don't forget to set POWERSHELL_TELEMETRY_OPTOUT=1 in your environment before launching PowerShell!

How often do you need to reapply this?

Set it in your environment / shell startup files (.bash_profile, for example)

  export POWERSHELL_TELEMETRY_OPTOUT=1
and, in theory, you should be good to go (unless/until Microsoft decides to change things up).

---

After logging out and logging in again, you can verify this has been set properly by simply running

  echo $POWERSHELL_TELEMETRY_OPTOUT
in your shell (it should simply output "1").

Re: Two Months with Powershell on a Unix

#78
post #7

If you don't want PowerShell reporting your activities back to the mothership, don't forget to set POWERSHELL_TELEMETRY_OPTOUT=1 in your environment before launching PowerShell!

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.

Re: Two Months with Powershell on a Unix

#79
post #69
post #54

Earlier quoted context omitted.

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.

Yes, but, POSIX shells aren’t that much more discoverable, either. It takes loads of reading and trial and error to become competent in any command line.

The worst/easiest to fix discoverability problem with Microsoft prompts is that they show you a single completion on tab and cycle through them on every subsequent tab, which is a lot more confusing than being shown all the options, in my opinion.

Re: Two Months with Powershell on a Unix

#80
post #7

If you don't want PowerShell reporting your activities back to the mothership, don't forget to set POWERSHELL_TELEMETRY_OPTOUT=1 in your environment before launching PowerShell!

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
Post reply on HN