Linux:如何将文本正确地导入程序?

Linux:如何将文本正确地导入程序?,linux,file,terminal,command,pipe,Linux,File,Terminal,Command,Pipe,我找过了,但什么也找不到。例如,我使用的TTS程序允许您执行以下操作: ~#festival -tts | echo "I am to be spoken" 这真的很好,但是对于我使用的程序,比如hextump,我不知道如何将文本导入其中。我真的可以使用其中的一些东西,我尝试过(但失败)的一些例子如下: ~#gtextpad < dmesg //(how do I put the contents into the text pad for display? not just

我找过了,但什么也找不到。例如,我使用的TTS程序允许您执行以下操作:

~#festival -tts | echo "I am to be spoken"
这真的很好,但是对于我使用的程序,比如hextump,我不知道如何将文本导入其中。我真的可以使用其中的一些东西,我尝试过(但失败)的一些例子如下:

~#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..)
~#gtextpad
hextump(1)
手册页:

hextump实用程序是一个过滤器,它以用户指定的格式显示指定的文件或标准输入(如果未指定文件)

因此:


管道中的数据流(由管道符号分隔的一系列命令)从左向右流动。因此,下面command1的输出将进入command2的输入,依此类推

command1 |
command2 |
command3 arg1 arg2 arg3 |
sort |
more
因此,要将“echo”的输出输入到“hextump”,请使用:

echo "I am to be dumped" | hexdump

我不明白你展示的“节日”命令是如何工作的。shell做了足够多的工作,如果不做不必要的假设和大量的欺骗,然后仍然依赖于内核中的调度决策来“正确”,我看不出它是如何工作的。

以下是一些将文本传递到hexdump的方法

标准文本:

echo“text”| hextump

这里是文件

hexdump <<EOF
text
EOF

在bash上,您也可以这样做

hexdump <<< "Pipe this text into hexdump"

hexah。另一方面,现在我可以做一些我想做的有用的自动化的事情。有关

hexdump file
hexdump <<< "Pipe this text into hexdump"