1
2
3
4
5
6
7
8
9
10
#!/bin/bash
for i in `seq 1 10`;do echo $i;done > ./test.txt
while read line;do var="$var,$line";done < test.txt
echo $var|sed 's/^,//g;s/,$//g'
1,2,3,4,5,6,7,8,9,10
转载于:https://blog.51cto.com/qiufengsong/1397946
1
2
3
4
5
6
7
8
9
10
#!/bin/bash
for i in `seq 1 10`;do echo $i;done > ./test.txt
while read line;do var="$var,$line";done < test.txt
echo $var|sed 's/^,//g;s/,$//g'
1,2,3,4,5,6,7,8,9,10
转载于:https://blog.51cto.com/qiufengsong/1397946