【发布时间】:2017-05-18 08:09:28
【问题描述】:
在 Bash 中,我如何在 Bash 的数组中转换下面的字符串:
details="cl roo,dara shi,GD leader, is the man,YG FAMILY"
这是我的代码:
IFS="[a-z],[a-z]" read -r -a details_list <<< "$details"
数组迭代时的预期输出:
cl roo
dara shii
GD leader, is the man
YG FAMILY
数组迭代时的实际输出:
cl roo
dara shii
GD leader
is the man
YG FAMILY
【问题讨论】:
-
重复问题:这里是a link!
-
我已经检查过了,它与预期的输出不同。
-
您如何确定要中断的逗号?
-
我在想 bdelimiter 是放在两个字符之间的逗号......我不知道如何在正则表达式上使用它。
标签: arrays regex bash delimiter ifs