分页: 1 / 1

请教,用文件作输入来源,输入为空

发表于 : 2011-05-26 0:18
sanxingcheng

代码: 全选

~/test$ echo < test.txt

~/test$ cat test.txt
test
testtat
test4
t4t5
~/test$ 
test文件里有内容,但用 < test.txt 是显示的是空

Re: 请教,用文件作输入来源,输入为空

发表于 : 2011-05-26 0:31
cnkilior
echo 不是这么用的。

Re: 请教,用文件作输入来源,输入为空

发表于 : 2011-05-27 10:03
烟雨平生
你这个要求很正常,不过举的例子就很费解了:
既然要显示test.txt的内容,为什么要用echo,用cat不是更好么

Re: 请教,用文件作输入来源,输入为空

发表于 : 2011-05-27 10:43
BigSnake.NET

代码: 全选

echo "$(< test.txt )"

Re: 请教,用文件作输入来源,输入为空

发表于 : 2011-06-23 22:44
tusooa
关键问题是,echo 不读取文件.
echo看参数的.