开发者

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 -
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜