| >The problem with pipelines of objects is that it is inherently a more strongly typed, defined, interface. And therefore special-case. Not true. While I am somewhat of a novice at powershell, I didn't find that to be the case at all. > Streams of characters is as loosely typed as it gets. And for processing text files and gluing disjointed tools together, it may seem crude, but is very effective. Especially for quick text processing jobs, or automating series of commands. Well done for the Pavlovian regurgitation of how piping text output is supposed to work. I don't like working with it. It is okay for small scripts. However if it is mildly complicated I would use something like Python (not powershell). Powershell is great for small scripts where you need to do sysadmin tasks e.g. I have a script where I setup my SQL Database aliases for development. Piping text about doesn't help me in these sorts of tasks. I need to go "I need to find where the real database is, and then map those properties to an alias". That works better with piping objects. It works kinda like functional concepts such as map(), reduce() etc. You should use the right tool for the right job. > The UNIX shell concept has been honed and refined over 50 years to do exactly what it does, and it does it very well. It is also extremely generic. This choice was on purpose and has stood up well to the test of time. You know not everyone thinks that Unix was the pinnacle of human achievement. |
> You should use the right tool for the right job.
Agree. UNIX however, has a fundamental file and character based structure. Windows, the opposite. So while powershell and its predecessors are useful in that environment, it's not equally suited to the tasks that bash is used for.
So what I'm poking at is that while bash isn't a great tool for interfacing with the service manager, or registry, or policy frameworks and the like (SQL, definitely), powershell is not a general purpose command processor and text manipulator. And on UNIX, whether you like that philosophy or not, that's all you need. I would never want to use a powershell script to move and rename file structures with some rules and variables.
> It is okay for small scripts.
That's what it's designed for and how it should be used. If you are talking about libraries or even a lot of functions, or if it's thousands of lines long, other more formal programming languages like Python (and with good debuggers) would be better. But to just bang out an adduser script in 30 minutes, that's where shell is lightweight enough to really shine.
Look, typed OO pipelines sound like a good idea, but the negative side is this. For example, to deal with the registry, you have to have purpose built library like https://docs.microsoft.com/en-us/powershell/module/microsoft... that someone needs to write and then everyone has to know. This has to be done for every kind of interface in windows. This is just as complex as Pythons standard libraries or writing C or C++ Win32 code.
With the UNIX toolkit philosophy, I have about 20 utilities and builtins to know: shell + awk/grep/sed/cut/etc. And that's it. The cons are #1 efficiency is lower and #2 as pointed out by many folks, a lot of scripts spend a lot of code inline (in different ways) things like how to parse a config file.
But back to the article. It's not valid to just presumptively state like a fact that one is better than the other as the argument. And it's really not valid to compare such different tools head-to-head when it's the whole underlying philosophies of their associated ecosystems that are so different.