3 ms·
What I love about PowerShell is that it allows you to pipe structured data between tools without needing to 'screen scrape' the output like on Linux. I still d
by GekkePrutser 4y ago
What I love about PowerShell is that it allows you to pipe structured data between tools without needing to 'screen scrape' the output like on Linux.
I still don't use it on Linux but I do think it's a big step forward for scripting.
- Mister_Snuggles 4y agoFreeBSD has integrated libxo[0] into a lot of its base utilities, so you can use something like `netstat --libxo json` to get structured data that can be sliced and diced with other tools. Unfortunately, it hasn't been extended to all of the base system yet (ls, for example, doesn't support libxo output). For example: $ w --libxo json|json_pp { "uptime-information" : { "days" : 46, "hours" : 22, "load-average-1" : 0.19, "load-average-15" : 0.13, "load-average-5" : 0.12, "minutes" : 11, "seconds" : 34, [...] Obviously it's not as extensive as PowerShell, but it definitely gets rid of screen-scraping. [0] https://www.freebsd.org/cgi/man.cgi?query=libxo&sektion=3&format=html https://www.freebsd.org/cgi/man.cgi?query=libxo&sektion=3&fo...
- GekkePrutser 4y agoOoh this is really cool, thanks for sharing. FreeBSD is actually my daily driver so that'll really come in handy.
- d0mine 4y agoActually, it is a step backwards: unless you control both sides (perfect version compatibility), passing text to extract only parts you care about is more resilient (think SOAP vs. REST).