Re:/usr/bin/time: not the command you think you know
by jcoffland on Tuesday March 07, 2017 @02:16AM
(#13808814)
Run these commands for a better demonstration:
vs.
The former times the entire pipeline whereas the later only times the first command in the pipe.
[ Parent
| on HN ]
Re:/usr/bin/time: not the command you think you know
by fnord123 on Tuesday March 07, 2017 @05:09AM
(#13809386)
This also gives the time of the entire pipeline (since the commands all begin together and only finish when the last command has completed):
echo | /usr/bin/time sleep 1
Re:/usr/bin/time: not the command you think you know
by roblabla on Tuesday March 07, 2017 @07:31AM
(#13809850)
I'm pretty sure this is wrong.
As an example :
sleep 2 | /usr/bin/time sleep 1
This gives an output of "1 second" even though the entire pipeline took 2 seconds.
Re:/usr/bin/time: not the command you think you know
by fnord123 on Tuesday March 07, 2017 @08:15AM
(#13810037)
Ok you can wangle your way out of it. But if you're doing something like `grep "$something" | /usr/bin/time some_job` then generally you're fine.