4 ms·
I think Powershell gets you part of the way down this road, at least on some of these features, without requiring you to figure out everything/adopt everything
by partdavid 5y ago
I think Powershell gets you part of the way down this road, at least on some of these features, without requiring you to figure out everything/adopt everything first. Out of the box it works fine as a Unix shell (you know, invokes commands, pipes output, etc.).
Everything's not rosy-hunky-dory, each of these have limitations but:
> Can I get a parseable ls?
> Can I get explicit output-as-json flags for all reasonable commands like ps, lsblk, ls, find, grep, etc?
Better than "parseable", you get commands which just return the structured data, for ls (gci), and many other "foundation" commands like ps (gps), etc. I didn't actually think about a structured grep but maybe you wouldn't use it as much with stuff like ConvertFrom-Csv (so you have structured data to select rather than strings to "grep"). Anything you can get JSON or YAML or CSV output from you can just turn into structured data (ConvertFrom-Json) and handle in the same way. Any native Powershell implementation of anything will emit complex data in the same way (e.g. AWS's Powershell tools).
> Can I get a database of commands better than history that shows when they were run and error codes that resulted AND THE OUTPUT, and if it completed for multithreaded/background/etc.
Background job handling is a lot better with Powershell than with bash and allows you to address background jobs by id, get metadata about them and the output, with rcjb (Receive-Job). Your job list is manipulatable with the same Powershell tools as everything else, so you can sort and select easily on things like status or the host on which it executed.
> Can I get a reasonable metashell standard across all terminal apps for doing a lot of what .profile does but isn't tied to a specific file on a specific machine?
It's an interesting idea, hard for me to conceive. Do you mean shell and command configurations that go along with your shell session to other machines? Powershell remoting allows you to establish a session and then mix local and remote commands while retaining your setup and environment, it may partly help. The gotcha: you need to enable the SSH configuration which allows this and (of course) have Powershell installed on the target systems.