On Thu, Jan 26, 2017 at 12:19:10PM -0800, Kannan Varadhan wrote:
Some of the commands I run seem to take a long time, but also
varying amounts of time.
I'd like to prefix "time" to every command that runs. So that,
when I type:
% make long-running-target
I'd like to see the equivalent of:
% time make long-running-target
...
make long-running-target 0.00s user 0.00s system 66% cpu
0.004 total
I thought preexec() might help:
preexec() {
set $3
eval time "$@"
}
but this ends up running the same command twice, once timed, and
once without.
Setting REPORTTIME does the trick:
REPORTTIME=1 # stats for procs using 1 or more seconds
Ciao
Dominik ^_^ ^_^