1、使⽤for循环 -⽂件内容玩游戏电脑配置推荐
for line in `cat filename`
do
echo $line
done
或者
for line in $(cat filename)
端午节的古诗20首do
世界之窗好玩吗echo $line
done
周冬雨刘昊然恋情2、使⽤for循环 -⽂件名称
for line in `ls fileParentPath`
do
读取配置文件失败echo $line
done
或者
for line in $(ls fileParentPath)
do
echo $line
done
3.使⽤while循环 -⽂件名称
淘宝关键词优化while read line
do
echo $line
done < filename
4.使⽤source循环 读取配置⽂件
#!/bin/bash
source config
echo $pramaeter1
echo $pramaeter2
echo ....
5.使⽤while循环 -读取配置⽂件
#!/bin/bash
for line in `cat config`
do
eval "$line"
done
echo $pramaeter1
echo $pramaeter2
echo ....
或者
#!/bin/bash
for line in $(cat config)
do
eval "$line"
done
echo $pramaeter1
echo $pramaeter2
echo ....
发布评论