在bash中将字符串转换为字典

时间:2017-09-18 17:42:53

标签: bash

如何将字符串转换为bash字典?我得到以下格式的字符串。

{ foo1 = [ "User1", "User2" ] bar1 = [ "User3", "User4" ] }
{ foo2 = [ "User5", "User6" ] }
{ foo3 = ["User7", "User8"] , bar2 = [ "User9", "User10", "User 11" ], moo = ["User12"] }

我必须在bash字典中转换为以下格式。

`( ["foo1"]= ("User1,User2") , ["bar1"]= ( "User3,User4" ))`
`( ["foo2"]=( "User5,User6" ) )`
`( ["foo3"]=("User7"), ["bar2"] = ( "User9,User10,User 11" ), ["moo"] = 
("User12"))`

0 个答案:

没有答案