#!/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
运行结果是:
2024-01-18 13:06:22
#!/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
运行结果是:
下一篇:C++ 文件操作I/O流