linux shell 按行读入文件

#/bin/bash

printf"*************************************\n"

echo"catfilewhilereadline"

cattest.txt|whilereadline

do

 echo$line;

done

printf"*************************************\n"

echo"whilereadline<file"

whilereadline

do

&nbsp;echo$line;

done<test.txt

printf"*************************************\n"

echo"forlineincattest.txt"

SAVEIFS=$IFS

IFS=$(echo-en"\n")

forlinein$(cattest.txt)

do

&nbsp;echo&nbsp;$line;

done

IFS=$SAVEIFS

相关推荐