其他分享
首页 > 其他分享> > for循环读取变量

for循环读取变量

作者:互联网


#!/bin/bash # #这里默认空格是分隔符 list="zhangSan Lisi WangEr Tom" for i in $list do echo "Name is $i"
done

运行结果是:

 

 2.IFS修改默认分隔符

#!/bin/bash
#

IFS=":"
list="zhangSan Lisi WangEr Tom"
for i in $list
do
        echo "Name is $i"
done

运行结果是:

 

 

标签:读取,WangEr,IFS,list,echo,循环,done,Tom,变量
来源: https://www.cnblogs.com/juanzhi/p/13054984.html