4 ms·
Well, I'm advocating for structured text, not binary. Mostly because I haven't seen a future-proof binary format yet, and editing binary formats indeed would re
by TeMPOraL 10y ago
Well, I'm advocating for structured text, not binary. Mostly because I haven't seen a future-proof binary format yet, and editing binary formats indeed would require special tooling. I think - for a data exchange protocol meant to be used between many applications - going structured text instead of binary is a worthwhile tradeoff of little lower efficiency vs. much better accessibility.
EDIT: Some comments here are slowly making me like the idea of a standard structured binary more and more.
- ryandrake 10y agoLet's say I want to know how many days since an asset on my web server has been modified. With bash + some standard unix tools, from the top of my head I have to do something like this: curl -svo /dev/null http://example.com/file 2>&1 | grep Last-Modified | cut -d ' ' -f 3- And that's just to get the last modified date in text form. Now I'm writing a script that parses that date and gets today's date, convert them to days, and subtract. YUCK! Wouldn't it be nice if your shell could do this? curl(http://example.com/file).response_headers.Last-Modified.subtract(date().now).days I think it would be nice.
- qwertyuiop924 10y agoYes, but as it stands, most of those would have to be builtins for that to work. I would rather have: curl -j example.com|select headers.Last-Modified|time before now|time to days Where the commands send and receive JSON.
- bandrami 10y agoCan you name me a single UNIX configuration file whose format is not "structured"?
- TeMPOraL 10y agoConfig files are less of a problem. The issue is with programs, which you want to use with pipes. Each has its own undocumented, arbitrary pseudo-structure with often inconsistent semantics, optimized for viewing by user.
- bandrami 10y agoWhat programs are you thinking of? Maybe this is my sysadmin bias but about 90% of my UNIX tools usage is on config files...
- JdeBP 10y agoLet me suggest an incendiary example: systemd systemctl status wibble.service : Displays human-readable information, with colours, line drawings, and variable-length free-form text; that is exceedingly hard for a program to parse reliably. Contrast with systemctl show wibble.service : Outputs machine-readable information, in systemd's favourite form of a Windows INI file.
- bandrami 10y agoYikes. Makes me glad I run Slackware. Though I seem to recall from The Init Wars that it was precisely this quality of SystemD that made people lob the charge that it violated the "Unix philosophy"
- TeMPOraL 10y agols, ps, du, df, ... pretty much all CLI tools. The kind you use in scripts.
- bandrami 10y agoAll four of which users are enjoined, over and over again, not to try to parse the output of (particularly ls). That is, those are the tools specifically not meant to be connected by pipelines, but merely used for operator convenience.
- qwertyuiop924 10y ago...But how do you extract that data otherwise?
- 10y ago