Linux:如何将文本正确地传递到程序中?

oni*_*kun 2 linux terminal command file pipe

我看过但找不到任何东西。我使用的程序(例如TTS)可让您执行以下操作:

~#festival -tts | echo "I am to be spoken"
Run Code Online (Sandbox Code Playgroud)

确实不错,但是对于我使用的程序(例如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..)
Run Code Online (Sandbox Code Playgroud)

gho*_*g74 5

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

标准输入:

echo "text" | hexdump

这里的文件

hexdump <<EOF
text
EOF
Run Code Online (Sandbox Code Playgroud)

处理整个文件

hexdump file
Run Code Online (Sandbox Code Playgroud)