The length of each row of the output file shell

 

test.sh

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

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

Export

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

 

 

reference:

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

 

Guess you like

Origin www.cnblogs.com/sea-stream/p/11403182.html