[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: json + bash

From: Pádraig Brady
Subject: Re: json + bash
Date: Fri, 28 Nov 2014 14:19:12 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 28/11/14 13:02, Greg Wooledge wrote:
> On Fri, Nov 28, 2014 at 10:25:52AM +0600, Sergei Tokaev wrote:
>> Hi out there. Will it be good to add json support in bash internally. As
>> in variable declarations: decalre "-j" "{"variable":"value"}"
> This doesn't seem like an appropriate addition to bash, in my opinion.
> Where do you draw the line?  Should bash also parse XML?  Windows .INI
> files?  Comma-separated-value text files with quotes around elements
> that contain commas?  Apache-style log files with quotes around fields
> that contain spaces?
> In my opinion, all of those things are inappropriate to add to bash.

Agreed. For example to represent INI values in the shell one can:

  $ eval $(crudini --get example.ini section)

That also does validation, like:

  $ crudini --get git/crudini/example.ini non-sh-compat
  space name

  $ crudini --get --format=sh git/crudini/example.ini non-sh-compat 1num
  Invalid sh identifier: 1num

As for json, I see that the jq utility has the '@sh' formatter,
which I've not looked into but probably has a similar function.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]