piping output from programs that do not output to STDOUT
Say I have a program that outputs to a file which is provided by an (required) argument:
开发者_StackOverflow社区./foo -o bar.txt
Is there any way to trick it into outputting to a pipe? This just outputs to a file named -
.
./foo -o - | less
You can use /dev/stdout
as the file name:
./foo -o /dev/stdout | less
This will feed the contents of bar.txt to filter as the file grows:
tail -f bar.txt | filter
other solution, create a named pipe:
mkfifo /tmp/myfifo; ./foo -o /tmp/myfifo
</tmp/myfifo cat -
精彩评论