23,125
社区成员
发帖
与我相关
我的任务
分享
[root@localhost bashShell.dir]# echo $head
aa,bb,cc
[root@localhost bashShell.dir]# echo $head | tr "," " "
aa bb cc
[root@localhost bashShell.dir]# arr=($(echo $head | tr "," " "))
[root@localhost bashShell.dir]# echo ${arr[0]}
aa
[root@localhost bashShell.dir]# echo ${arr[1]}
bb
[root@localhost bashShell.dir]#
[root@localhost bashShell.dir]# head="aa bb cc"
[root@localhost bashShell.dir]# arr=(${head})
[root@localhost bashShell.dir]# echo ${arr[0]}
aa
[root@localhost bashShell.dir]# echo ${arr[1]}
bb
[root@localhost bashShell.dir]# echo ${arr[2]}
cc
[root@localhost bashShell.dir]#