Farhadix
Farhadix

Reputation: 1457

Make a live fifo - bash

This is the standard piping: foo | bar

But I want make a delay between foo and bar, foo output is continues without finish.

I can do foo > myfile and n seconds after it start bar < myfile. it makes n seconds delay but the big problem is myfile gets huge and eats storage for nothing! How can I read from myfile and delete read line. something like FIFO.

I tried mkfifo but immediately bar starts the foo jumps out.

Upvotes: 0

Views: 75

Answers (1)

chepner
chepner

Reputation: 530902

You can use a third process between the two that sleeps, then starts passing the data along.

foo | { sleep 5; cat; } | bar

Upvotes: 1

Related Questions