5 ms·
Powershell is a great programming language an not a bad shell in and of itself, but using it in the same manner as a shell is quite painful. I tried to rewrite
by notalaser 11y ago
Powershell is a great programming language an not a bad shell in and of itself, but using it in the same manner as a shell is quite painful. I tried to rewrite some of my ksh stuff in Powershell after getting a job at a mostly Windows-only shop. Basically every ten-line function ended up into a fourty-line superthing that's subtly incomprehensible to anyone who doesn't know .net.
I get why Powershell is great for sysadmins (and especially on Windows, where so many system-level utils weren't built with the idea that you'd pipe their output in mind), but for me, it's a step back.
- Someone 11y agoI agree that Powershell for a large part doesn't feel like a shell. Yes, it has a CLI, and it has short commands (actually aliases for longer names), but using it feels more like programming, at least to me. Having said that, I can't vouch for your scripts, but my 10 line shell scripts are unlikely to handle 'edge' cases such as spaces, quotes and backticks in file names. Also, "incomprehensible to anyone who doesn't know .net" may be true, but your average shell script that builds on tools such as sort, grep, ls, cut, cat, sed, awk, etc. isn't that particularly comprehensible to people who don't know UNIX, either. Finally, I think it is likely that people who grow up on Powershell feel differently about this.
- notalaser 11y ago> Also, "incomprehensible to anyone who doesn't know .net" may be true, but your average shell script that builds on tools such as sort, grep, ls, cut, cat, sed, awk, etc. isn't that particularly comprehensible to people who don't know UNIX, either. Absolutely. The point is, "you can use familiar .NET functions and everything is an object" is not something that makes the whole thing easier if you're not familiar with .NET and don't want objects in your shell scripts :-). Powershell and Unix shell have vastly different descents, and it shows. It's more or less a historical accident that we're conflating them nowadays.
- JoBrad 11y agoFrom my own experience learning bat scripting then sh scripting and then powershell, the 40-line monstrosity is what happens when you first learn another scripting language. Sometimes the paradigm can be so different that simply trying to port one script to another language ends up being more difficult (but better, from a learning standpoint, for me) than simply starting over.
- notalaser 11y agoWell, I never claimed I properly learned Powershell :-). Like everything on the Internet, lack of success with a technology should be taken to mean a failure of that technology as much as a failure of the programmer attempting to use it. It may well have been a problem above the application layer.
- JoBrad 11y agoWould you say the same about people who haven't been able to master sed? Success with any technology is as dependent on the technology as it is on the user. :)