3 ms·
There's probably a happy middle. Basically what you're saying is that you want a weakly-typed format, which unpacking that statement yet further means that you
by jerf 16y ago
There's probably a happy middle. Basically what you're saying is that you want a weakly-typed format, which unpacking that statement yet further means that you want a format that lets you do pretty much anything to it. Types boil down to a set of restrictions on what the data can be and what you are permitted to do with it, and a hunk o' text (TM) is just about as untyped as you can get.
But it might be nice to pass around JSON or something instead. It isn't quite as untyped, but on the grand scale of things it's not very typed.
- snprbob86 16y agoI'm not saying that Unix's approach is the the final word on the subject. In fact, I quite agree with you: structured formats are a good idea. I, for one, would like to see --format options added to many of the standard Unix tools. I'd probably define --format= as a shortcut for specifying both --informat= and --outformat=. It would be great to have some sort of XPath or dotted object notation on the command line rather than hacking around with awk, sed, cut, etc. Rather than: ps -ef | awk -v p=$PPID 'p==$3{print $2}' Do: ps --format=xml | xquery "/process[ppid=$PPID]/pid" Or something like that. A bit more verbose, but far more understandable. If I were to design the future, every tool would have metadata which describes which input and output formats it supports and prefers, so that most --format arguments would be optional: ps | xquery "/process[ppid=$PPID]/pid" I'd prefer that 100 times over object piping.