You are not logged in.

#1 2010-02-07 05:02:44

Nullw0rm
Member
Registered: 2010-01-21
Posts: 16

How to I pipe simple things into programs?

I have seen the obvious piping for things such as program | more etc. And some allow text to be piped into it, for example the TTS (text to speech) program Festival, You'd type in..

festival -tts | echo "I am going to be spoken"

But it doesn't work for any other progams.. What I want to do is for example

hexdump foo.txt  INTO -->  hexdump | echo "I am going into hexdump"

How do I pipe text into a program? Hexdump requires a file to be specified (foo.txt for example), so maybe I want it to see the echo as text. If I can't, then some programs use strings, so I could really use it for that!.. smile

Offline

#2 2010-02-07 05:08:21

Ghost1227
Forum Fellow
From: Omaha, NE, USA
Registered: 2008-04-21
Posts: 1,422
Website

Re: How to I pipe simple things into programs?

echo "I am going into hexdump" | hexdump

.:[My Blog] || [My GitHub]:.

Offline

#3 2010-02-07 05:20:38

egan
Member
From: Mountain View, CA
Registered: 2009-08-17
Posts: 273

Re: How to I pipe simple things into programs?

Your examples don't make any sense... a pipe takes the stdout of the first program and uses it as the stdin of the second. What you want to do is the opposite direction as far as I can tell, which would be < when working with files... when working with regular stdout you need to reverse the pipe order as Ghost1227 posted.

Offline

#4 2010-02-07 06:34:10

sdolim
Member
Registered: 2010-01-20
Posts: 67

Re: How to I pipe simple things into programs?

Some programs that require a filename will understand "-" to mean "read from stdin".  Silly example: 

echo hello world | cat -

In bash, you can use command substitution to make a fake file that is actually the output of your process.  The filename looks like "<(command)".  Silly example:

hexdump <(echo hello world)

Offline

Board footer

Powered by FluxBB