Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux piping & loop

Tags:

linux

pipe

piping

Is it possible to create a loop using Linux pipes? E.g.

cmd1 | cmd2 | cmd3 | 'back to stdin cmd1'

In other words, I'd like stdout at cmd3 to be connected back to stdin of cmd1.

like image 281
jldupont Avatar asked Oct 07 '22 07:10

jldupont


1 Answers

You could use a named pipe/FIFO:

mkfifo cmd3-to-cmd1
cmd1 < cmd3-to-cmd1 | cmd2 | cmd3 >> cmd3-to-cmd1
like image 151
icktoofay Avatar answered Oct 12 '22 19:10

icktoofay