Sample Header Ad - 728x90

How to pipeline sleep? sleep pipeline doesn't work

1 vote
1 answer
3098 views
I wanted to simulate execution time of certain scripts for which I found sleep NUMBER does exactly what I want.
In my scenario I needed something like sleep 5 | command | sleep 5 ... But it behaved strangely so I've tested sleeps alone, and I was surprised that
This takes 10 seconds sleep 10 | sleep 5
and **this also takes 10 seconds** sleep 5 | sleep 10 I even tried sleep 1 | sleep in case sleep was listening to standard input stdin Only thing I got working is when I was looking on how to force stdout as argument (with xargs) sleep 3; echo 3 | xargs sleep; echo "finished" But since I need to time the whole execution I had to do time -p (sleep 3; echo 3) | (xargs sleep; echo "finished") Hoe to pipe sleeps? If there is a better way, I'd still ike to know why sleep 1 | sleep 1 isn't working in the first place?
Asked by jave.web (162 rep)
Feb 2, 2021, 06:50 PM
Last activity: Feb 3, 2021, 02:34 AM