[问题]如何将句子赋值给一个变量!
发表于 : 2008-05-11 16:40
大家好,我新学SHELL在这向大家请教个问题:
比如说我有个名字叫FILE的文件,它里面的内容如下:
This is a test line1
This is a test line2
This is a test line3
This is a test line4
This is a test line5
This is a test line6
我现在想把FILE文件里的每行整行都赋值给line这个变量
我写了如下命令:
for line in `cat FILE`
do
echo $line
done
exit
可是执行了之后却是显示每个单词为一行,请问要怎么赋值????
This
is
a
test
line1
This
is
a
test
line2
This
is
a
test
line3
This
is
a
test
line4
This
is
a
test
line5
This
is
a
test
line6
比如说我有个名字叫FILE的文件,它里面的内容如下:
This is a test line1
This is a test line2
This is a test line3
This is a test line4
This is a test line5
This is a test line6
我现在想把FILE文件里的每行整行都赋值给line这个变量
我写了如下命令:
for line in `cat FILE`
do
echo $line
done
exit
可是执行了之后却是显示每个单词为一行,请问要怎么赋值????
This
is
a
test
line1
This
is
a
test
line2
This
is
a
test
line3
This
is
a
test
line4
This
is
a
test
line5
This
is
a
test
line6