![]() In bash, commands like git abuse STDERR to send info back to the user. More: PowerShell gives me multiple output paths, one for data (to the next program) and another to the user who typed the command. This gives me consistency when I use the command, and saves painful work when I write a command. More: PowerShell standardizes parsing of command-line arguments. And it knows the type of the property, so nobody has to tell it what’s a number. In PowerShell, the sort command works on named properties of the piped object. In bash, the sort command can parse the piped text and sort on it. Here’s an example from Chapter 1 of PowerShell in Action. In bash, you output your data as text, and the next program parses that text. The data is structured and interrogable (I can ask it what fields it has). PowerShell does this piping, except with objects instead of lines of text. ![]() One sends text to STDOUT, the next reads it on STDIN. ![]() The UNIX-y shell commands have this magical power of composition: you can pipe the output of one to the input of another, and chain these to build tiny programs right on your command line. It builds on what those shells did right, and then gets it more right. Over the past few weeks I’ve begun learning PowerShell, and it’s an improvement over the UNIX (and family) shells, bash and ksh etc. “Why use bash when you have PowerShell?” <– words I did not expect to hear from my own mouth.
0 Comments
Leave a Reply. |