Tricking a Unix Commandline Program into Accepting a File Stream

Posted by Alan Storm on Stack Overflow See other posts from Stack Overflow or by Alan Storm
Published on 2010-03-09T05:43:38Z Indexed on 2010/03/09 5:51 UTC
Read the original article Hit count: 346

Filed under:
|
|

Hypothetical situation. I have a command line program in *nix (linux, BSD, etc.). It was written so that you pass it a text file as an argument

$ program file.txt

Run the program, it looks at the text in file.txt.

Is it possible to "trick" this program into accepting input from a file stream rather than reading a file via disk? I'm pretty comfortable using unix pipes to do stuff, but there's still something a little mysterious about their internals that make it so I can't say (definitively) yes or not to the above question.

© Stack Overflow or respective owner

Related posts about unix

Related posts about unix-programming