3 ms·
Because the shell has a lot of room for improvement. Try powershell for a bit. Look at its design, look at the things it can do that the unix shell has problems
by Sanddancer 11y ago
Because the shell has a lot of room for improvement. Try powershell for a bit. Look at its design, look at the things it can do that the unix shell has problems with.
Everything's an object. Instead of passing lines of text, you're passing objects, with properties, types, etc. This becomes important because of
Library files are first class citizens. Because the shell is string based, you have to wrap everything up in functions, creating helpers in order to use any sort of function. Powershell makes this trivial, such that you can use functions you wrote elsewhere in your scripts as if they were builtins. Hell, it's trivial to write a webserver that forks multiple processes in powershell.
Yes, the unix shell was revolutionary when it was released, but it's been hamstrung by tradition. The shell is long overdue for letting in more interesting abilties.
- viraptor 11y agoAnnoyingly they're "good enough". Default shell will always stay sh-compatible. Scripts will always default to bash. I'd love for something like powershell to take over the unix world (ok, not exactly powershell, it has its problems too), but I don't think that's going to happen for the next 20ish years. Hybrids like ipython shell are quite interesting for personal use though.
- notalaser 11y agoPowershell 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. :)
- moonshinefe 11y agoIn my experience Powershell requires a lot of .NET concepts to understand outside of C# syntax from what I recall, and the amount of typing was far greater than typical Linux shells. If I'm spending twice the time typing on average, even more advanced features won't win me over when I get to use them occasionally (while, again, typing way more on average). It should be saving you time, in the end.