我有一个来自 Curl 响应的字符串,我想将所有“id”放入一个 bash 数组中,以便以后使用它。
这是我的 curl 回复的片段:
{"id":"45bcd726916e452f814ffddda8a0885b","用户名":"bob","email:"something@test.com"}, {"username":"bob","email:"something@test.com"}, {"id":"054f765f23f14957b5bcd46a8b6f9cf1","username":"tom","email:"something2@test.com"},{"username":"bob","email:"something@test.com"}, {"id":"9929928686a84e4a854c85b4ff93c1cf","username":"sam","email:"something@3test.com"},{"username":"bob","email:"something@test.com"}, ...........
我希望输出是
$ echo ${n[0]}
45bcd726916e452f814ffddda8a0885b
$ echo ${n[1]}
054f765f23f14957b5bcd46a8b6f9cf1
$ echo ${n[1]}
9929928686a84e4a854c85b4ff93c1cf
请帮忙,我已经被困了好几个小时了。