开发者

piping output from programs that do not output to STDOUT

开发者 https://www.devze.com 2023-02-07 23:03 出处:网络
Say I have a program that outputs to a file which is provided by an (required) argument: 开发者_StackOverflow社区

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

精彩评论

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