#!/bin/sh
redf(){
maxline=$( wc -l < "$1" )
#echo "$maxline"
for filename1 in `seq $maxline`
do
read filename
# echo "filename:$filename"
if [[ $filename == "aa" ]]
then
echo "find it"
break
else
let "count +=1"
fi
done < "$1"
echo "count times is $count"
}
redf $1
读取一行然后赋给两个变量
#!/bin/sh
read2(){
while IFS='' read line
do
read key value <<< $line
echo $key
echo "and"
echo $value
echo "_____________________"
done < $1
}
read2 $1