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
  útf8name
  1num
  ls;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.

thanks,
Pádraig.

Reply via email to