现有p1=("1a:2b:3c:4d:5e:6f:7g:8h")
需转化为如下变量:
p1=('1a','2b','3c','4d','5e','6f','7g','8h')
shell代码如下
p1=("1a:2b:3c:4d:5e:6f:7g:8h")echo ${p1}v_p1=${p1//:/\',\'}echo ${v_p1}v_p2="('"${v_p1}"')"echo ${v_p2}p1=$v_p2echo $p1