首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > UNIXLINUX >

这个下令到底起什么作用哦

2013-08-01 
这个命令到底起什么作用哦?echo Text through stdin stdin | cat - file.txt得到的结果是 Text through

这个命令到底起什么作用哦?

echo 'Text through stdin stdin' | cat - file.txt
得到的结果是 Text through stdin stdin


echo 'Text through stdin stdin'  的结果也是
Text through stdin stdin

我想问下这标红的部分,到底起什么作用,感觉加与不加都一个样呀。


[解决办法]
要加啊,那是因为你的file文件里面没有东西,要是有东西,结果就不一样了。
[解决办法]
LS正解,把标准输入和输入文件的内容拼接在一起,file.txt 里写的东西再试试看。
[解决办法]
是这样吧,哥:
echo 'Text through stdin stdin' 
[解决办法]
 cat - > file.txt

cat会将第一个参数作为标准输入,-表示将管道作为标准输入,但cat的标准输出是终端,你必须>file.txt才能打到file.txt里。

热点排行