I wanted to simulate execution time of certain scripts for which I found
In my scenario I needed something like sleep 5 | command | sleep 5 ... But it behaved strangely so I've tested
This takes 10 seconds
and **this also takes 10 seconds**
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
sleep
s 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
Last activity: Feb 3, 2021, 02:34 AM