html tool

2024年2月28日星期三

转:shell分割字符

 参考:https://blog.csdn.net/u010003835/article/details/80750003

]# st="atbtst"
]# ar=(${st//t/ })
]# echo ar[0]
ar[0]
]# echo ${ar[0]}
a
]# echo ${ar[1]}
b

其中ar=(${st//t/ })参考:https://blog.csdn.net/u010003835/article/details/80749220
使用空格 替换$st变量中全部的t,定义为新的数组ar

没有评论:

发表评论