test.sh

#!/bin/bash
string="hello,shell,split,test"
array=(${string//,/ })

for var in ${array[@]}
do
   echo $var
done

输出

bogon:conf macname$ awk '{print length($0)}' test.sh 
11
33
24
1
22
2
12
4

 

 

参考:

https://www.jb51.net/article/121290.htm

 

相关文章:

  • 2022-12-23
  • 2022-01-13
  • 2022-12-23
  • 2021-08-12
  • 2022-12-23
  • 2021-12-26
  • 2021-06-20
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-10
相关资源
相似解决方案