2010-02-07 62 views
1

我看了,但找不到任何东西。程序例如,我使用TTS可以让你做到以下几点:Linux:我如何正确地将文本输入程序?

~#festival -tts | echo "I am to be spoken" 

这是非常好的,但是对于节目我用,如hexdump都可以,我不知道怎么管的文本到它。我真的可以使用其中的一些东西,一些例子我试图(但失败了),就像这样:

~#gtextpad < dmesg 
     //(how do I put the contents into the text pad for display? not just into a file) 
~#hexdump | echo "I am to be put into hexdump" 
     //(How do I get hexdump to read the echo? It normally reads a file such as foo.txt..) 

回答

3

这里是通过文字进制打印

标准输入的一些方法:

echo "text" | hexdump

这里记录

hexdump <<EOF 
text 
EOF 

来处理整个文件

hexdump file 
+0

啊。反过来,现在我可以做一些我想要的有用的自动化的东西。 – 2010-02-07 05:36:48

2

hexdump(1)手册页:

的hexdump工具是显示指定的一个过滤器文件或标准输入,如果没有指定文件,则以用户指定的格式。

所以:

echo "I am to be put into hexdump" | hexdump 
3

在管线中的数据流(一系列由管道符号分开的命令的)流从左到右。因此,下面的command1的输出转到command2的输入,依此类推。

command1 | 
command2 | 
command3 arg1 arg2 arg3 | 
sort | 
more 

因此,要获得“回响”输出到“hexdump都”,使用:

echo "I am to be dumped" | hexdump 

我没有看到你展示“节日”命令是如何工作的。 shell做了足够的准备工作,没有做出不合理的假设,做了大量的诡计,然后仍然依靠内核中的调度决策来让事情“正确”,但我不明白它是如何工作的。

2

在bash上,你也可以做

hexdump <<< "Pipe this text into hexdump" 
相关问题