Chris Angelico <ros...@gmail.com>: > On Wed, Mar 2, 2016 at 4:41 PM, Marko Rauhamaa <ma...@pacujo.net> wrote: >> I was talking about JSON for the standard I/O, not the command-line >> arguments, as in: >> >> ps -ef | awk '/httpd/ { print $2 }' >> >> where "ps -ef" emits SPC-separated fields and LF-separated records, and >> awk parses and processes them. > > If you want to change that, you have to change the entire ecosystem, > not just the shell. You would have to teach every single program to > use a different structure.
Correct. There could be translation utilities in the interim. > A lot of programs already do support NUL-separation - usually with a > -z parameter or something. But you won't be able to magically get them > all to use JSON. And I doubt it would be advantageous anyway. The advantages are obvious. Barely any programs do proper escaping, and security problems abound. Maybe a starting point would be a Python Toybox (<URL: https://en.wikipedia.org/wiki/Toybox>). Ecosystem intertia aside, key to the success of such an endeavor would be to find a Python equivalent for ps -ef | awk '/httpd/ { print $2 }' that would be at least as convenient for the fingers and the eye. Marko -- https://mail.python.org/mailman/listinfo/python-list